card-validator
Advanced tools
Comparing version 2.3.0 to 3.0.0
@@ -0,1 +1,7 @@ | ||
3.0.0 | ||
===== | ||
- 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`. | ||
2.3.0 | ||
@@ -2,0 +8,0 @@ ===== |
{ | ||
"name": "card-validator", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"description": "A library for validating credit card fields", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
"gulp-watch": "^0.6.8", | ||
"mocha": "^2.2.1", | ||
"mocha": "^3.0.0", | ||
"sinon": "^1.14.1", | ||
@@ -37,5 +37,5 @@ "sinon-chai": "^2.7.0", | ||
"dependencies": { | ||
"credit-card-type": "^4.0.0", | ||
"credit-card-type": "^5.0.0", | ||
"lodash": "3.10.1" | ||
} | ||
} |
@@ -255,24 +255,54 @@ # Credit Card Validator [![Build Status](https://travis-ci.org/braintree/card-validator.svg)](https://travis-ci.org/braintree/card-validator) [![npm version](https://badge.fury.io/js/card-validator.svg)](http://badge.fury.io/js/card-validator) | ||
#### `valid.expirationMonth(value: string): boolean` | ||
#### `valid.expirationMonth(value: string): object` | ||
`expirationMonth` accepts 1 or 2 digit months. `1`, `01`, `10` are all valid entries. | ||
```javascript | ||
{ | ||
isValidForThisYear: false, | ||
isPotentiallyValid: true, | ||
isValid: true | ||
} | ||
``` | ||
- - - | ||
#### `valid.expirationYear(value: string): boolean` | ||
#### `valid.expirationYear(value: string): object` | ||
`expirationYear` accepts 2 or 4 digit years. `16` and `2016` are both valid entries. | ||
```javascript | ||
{ | ||
isCurrentYear: false, | ||
isPotentiallyValid: true, | ||
isValid: true | ||
} | ||
``` | ||
- - - | ||
#### `valid.cvv(value: string, maxLength: integer): boolean` | ||
#### `valid.cvv(value: string, maxLength: integer): object` | ||
The `cvv` validation by default tests for a numeric string of 3 characters in length. The `maxLength` can be overridden by passing in an `integer` as a second argument. You would typically switch this length from 3 to 4 in the case of an American Express card which expects a 4 digit CID. | ||
```javascript | ||
{ | ||
isPotentiallyValid: true, | ||
isValid: true | ||
} | ||
``` | ||
- - - | ||
#### `valid.postalCode(value: string): boolean` | ||
#### `valid.postalCode(value: string): object` | ||
The `postalCode` validation essentially tests for a valid string greater than 3 characters in length. | ||
```javascript | ||
{ | ||
isPotentiallyValid: true, | ||
isValid: true | ||
} | ||
``` | ||
## Design decisions | ||
@@ -282,2 +312,3 @@ | ||
- `valid.expirationDate` will only return `month:` and `year:` as strings if the two are valid, otherwise they will be `null`. | ||
- Since non-US postal codes are alpha-numeric, the `postalCode` will allow non-number characters to be used in validation. | ||
@@ -284,0 +315,0 @@ ## Development |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
22884
323
0
+ Addedcredit-card-type@5.0.4(transitive)
- Removedcredit-card-type@4.1.0(transitive)
Updatedcredit-card-type@^5.0.0