1.0.0 • Published 8 years ago

credit-card-details v1.0.0

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
8 years ago

credit-card-details

This module contains functions to validate and mask credit card form fields.

API

maskField( fieldName, previousValue, nextValue )

Returns a masked input value for the given field based on the current value and the next value to replace it with.

unmaskField( fieldName, previousValue, nextValue )

Returns an unmasked input value that is meant to be used within the program rather than displayed to the user.

validateCardDetails( cardDetails )

Returns an object containing the errors for each field. For example the returned object might look like this:

{ number: [ 'Invalid credit card' ] }

If there are any missing fields, there are no errors for that field.

Taken from https://github.com/Automattic/wp-calypso/tree/master/client/lib/credit-card-details

1.0.1

8 years ago

1.0.0

8 years ago