card-validator
Advanced tools
Changelog
9.0.0
Changelog
8.0.0
Breaking Changes
export =
instead of export default
for main export (use "esModuleInterop": true
flag in your tsconfig to maintain the default
module behavior)Changelog
7.1.0
default
import when using es modules (thanks @leomp12)Changelog
7.0.0
Breaking Changes
new String(number)
Changelog
6.2.0
Adjust expiration date to accept dates formatted as YYYY-MM
(the HTML autofill spec). Closes #69 (thanks @schuylr)
Add option to set a maxLength
for card number validation
Update credit-card-type to v8.0.0
Breaking Changes
When adding or updating cards, this module no longer uses an exactPattern
and prefixPattern
model. Instead, it takes an array of patterns. See https://github.com/braintree/credit-card-type#pattern-detection for details.
Add optional options object with luhnValidateUnionPay
parameter to force luhn validity check of UnionPay cards
Update tests to account for ELO cards
Update credit-card-type
to v7.0.0
Breaking Changes
Mastercard enum changed from master-card
to mastercard
Support custom card brands
Require minimum version of credit-card-type to be v6.2.0
Allow maxElapsedYear
to be configurable in expirationYear
and expirationDate
(thanks @wozaki)
Update credit-card-type
to v6.0.0
Add options object for postal code validation to specify min length
Breaking change: Remove dist
files. You must use npm
to use this module
Breaking change: Remove support for primitive constructors like new String()
Fix postal code validation to be valid if 3 or more characters
correctly identify Maestro cards beginning with 6
Breaking change: The format of the card
object returned has changed. pattern
has been replaced by prefixPattern
and exactPattern
.
valid.expirationDate can take an object with month and year fields or a string value
Update dist
to include version 4.0.3
of credit-card-type
Including dist
from 2.2.6
Fixes cases where card numbers were incorrectly reported as isPotentiallyValid: false
when more digits could still be entered
Fixes expiration date results when year is current year and month is invalid
Update files in dist/
Readme clarifications
Fixes validation of space separated expiration dates
Fixes potential validity of slashless expiration dates
Fixes validation of expiration dates that are too long
Fixes CVV validation to not always validate 3-digit values as isValid: true
Fixes 3-digit expiration date handling, such as 220 being Feb, 2020
Use one Lodash dependency
CVV validator can accept an array of possible length values
Contextually validate month based on current date.
Update credit-card-type
to 4.0.0
The npm module now includes built files under dist/
.
The returned value for card.length
is now an Array
and called card.lengths
to account for variable-length cards such as UnionPay.
Initial release