card-validator
Advanced tools
Comparing version 6.2.0 to 7.0.0
102
CHANGELOG.md
@@ -1,22 +0,27 @@ | ||
6.2.0 | ||
===== | ||
# 7.0.0 | ||
- Add typescript types | ||
_Breaking Changes_ | ||
- Upgrade credit-card-type to v9.0.0 | ||
- Drop support for card numbers instantiated with `new String(number)` | ||
# 6.2.0 | ||
- Adjust expiration date to accept dates formatted as `YYYY-MM` (the HTML autofill spec). Closes #69 (thanks @schuylr) | ||
6.1.0 | ||
===== | ||
# 6.1.0 | ||
- Add option to set a `maxLength` for card number valiation | ||
6.0.0 | ||
===== | ||
# 6.0.0 | ||
- Update credit-card-type to v8.0.0 | ||
*Breaking Changes* | ||
_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. | ||
5.1.0 | ||
===== | ||
# 5.1.0 | ||
@@ -26,12 +31,11 @@ - Add optional options object with `luhnValidateUnionPay` parameter to force luhn validity check of UnionPay cards | ||
5.0.0 | ||
===== | ||
# 5.0.0 | ||
- Update `credit-card-type` to v7.0.0 | ||
*Breaking Changes* | ||
_Breaking Changes_ | ||
- Mastercard enum changed from `master-card` to `mastercard` | ||
4.3.0 | ||
===== | ||
# 4.3.0 | ||
@@ -41,57 +45,47 @@ - Support custom card brands | ||
4.2.0 | ||
===== | ||
# 4.2.0 | ||
- Allow `maxElapsedYear` to be configurable in `expirationYear` and `expirationDate` (thanks @wozaki) | ||
4.1.1 | ||
===== | ||
# 4.1.1 | ||
- Update `credit-card-type` to v6.0.0 | ||
4.1.0 | ||
===== | ||
# 4.1.0 | ||
- Add options object for postal code validation to specify min length | ||
4.0.0 | ||
===== | ||
# 4.0.0 | ||
- __Breaking change__: Remove `dist` files. You must use `npm` to use this module | ||
- __Breaking change__: Remove support for primitive constructors like `new String()` | ||
- **Breaking change**: Remove `dist` files. You must use `npm` to use this module | ||
- **Breaking change**: Remove support for primitive constructors like `new String()` | ||
3.0.1 | ||
===== | ||
# 3.0.1 | ||
- Fix postal code validation to be valid if 3 or more characters | ||
3.0.0 | ||
===== | ||
# 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`. | ||
- **Breaking change**: The format of the `card` object returned has changed. `pattern` has been replaced by `prefixPattern` and `exactPattern`. | ||
2.3.0 | ||
===== | ||
# 2.3.0 | ||
- valid.expirationDate can take an object with month and year fields or a string value | ||
2.2.8 | ||
===== | ||
# 2.2.8 | ||
- Update `dist` to include version `4.0.3` of credit-card-type | ||
2.2.7 | ||
===== | ||
# 2.2.7 | ||
- Including `dist` from `2.2.6` | ||
2.2.6 | ||
===== | ||
# 2.2.6 | ||
- Fixes cases where card numbers were incorrectly reported as `isPotentiallyValid: false` when more digits could still be entered | ||
- issue #20 and PR #21 | ||
2.2.5 | ||
===== | ||
# 2.2.5 | ||
@@ -102,4 +96,3 @@ - Fixes expiration date results when year is current year and month is invalid | ||
2.2.4 | ||
===== | ||
# 2.2.4 | ||
@@ -110,45 +103,36 @@ - Fixes validation of space separated expiration dates | ||
2.2.3 | ||
===== | ||
# 2.2.3 | ||
- Fixes CVV validation to not always validate 3-digit values as `isValid: true` | ||
2.2.2 | ||
===== | ||
# 2.2.2 | ||
- Fixes 3-digit expiration date handling, such as 220 being Feb, 2020 | ||
2.2.1 | ||
===== | ||
# 2.2.1 | ||
- Use one Lodash dependency | ||
2.2.0 | ||
===== | ||
# 2.2.0 | ||
- CVV validator can accept an array of possible length values | ||
2.1.0 | ||
===== | ||
# 2.1.0 | ||
- Contextually validate month based on current date. | ||
2.0.2 | ||
===== | ||
# 2.0.2 | ||
- Update `credit-card-type` to 4.0.0 | ||
2.0.1 | ||
===== | ||
# 2.0.1 | ||
- The npm module now includes built files under `dist/`. | ||
2.0.0 | ||
===== | ||
# 2.0.0 | ||
- The returned value for `card.length` is now an `Array` and called `card.lengths` to account for variable-length cards such as UnionPay. | ||
1.0.0 | ||
===== | ||
# 1.0.0 | ||
- Initial release |
{ | ||
"name": "card-validator", | ||
"version": "6.2.0", | ||
"version": "7.0.0", | ||
"description": "A library for validating credit card fields", | ||
"main": "index.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"repository": { | ||
@@ -12,4 +13,8 @@ "type": "git", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "npm run lint && mocha test/**/*.js" | ||
"prepublishOnly": "npm run build", | ||
"prebuild": "prettier --write .", | ||
"build": "tsc --declaration", | ||
"lint": "eslint --ext js,ts .", | ||
"posttest": "npm run lint", | ||
"test": "jest" | ||
}, | ||
@@ -19,12 +24,22 @@ "author": "Braintree <code@getbraintree.com> (https://www.braintreepayments.com/)", | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-braintree": "^2.0.0", | ||
"mocha": "^6.1.4", | ||
"sinon": "^7.3.2", | ||
"sinon-chai": "^3.3.0" | ||
"@types/jest": "^25.2.1", | ||
"@types/node": "^13.11.1", | ||
"eslint": "^6.8.0", | ||
"eslint-config-braintree": "^5.0.0-typescript-prep-rc.17", | ||
"jest": "^25.3.0", | ||
"prettier": "^2.0.4", | ||
"ts-jest": "^25.3.1", | ||
"typescript": "^3.8.3" | ||
}, | ||
"dependencies": { | ||
"credit-card-type": "^8.0.0" | ||
"credit-card-type": "^9.0.0" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "src/__tests__/tsconfig.json" | ||
} | ||
} | ||
} | ||
} |
@@ -22,5 +22,5 @@ # 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) | ||
```javascript | ||
var valid = require('card-validator'); | ||
var valid = require("card-validator"); | ||
var numberValidation = valid.number('4111'); | ||
var numberValidation = valid.number("4111"); | ||
@@ -40,3 +40,3 @@ if (!numberValidation.isPotentiallyValid) { | ||
- - - | ||
--- | ||
@@ -247,3 +247,3 @@ #### `valid.number(value: string, [options: object]): object` | ||
- - - | ||
--- | ||
@@ -265,11 +265,11 @@ #### `valid.expirationDate(value: string|object, maxElapsedYear: integer): object` | ||
| Input | Output | | ||
|-------------------------------------------------------------------------------------------|-------------------------------| | ||
| `'10/19'`<br/>`'10 / 19'`<br />`'1019'`<br/>`'10 19'` | `{month: '10', year: '19'}` | | ||
| `'10/2019'`<br/>`'10 / 2019'`<br />`'102019'`<br/>`'10 2019'`<br/>`'10 19'` | `{month: '10', year: '2019'}` | | ||
| `'2019-10'` | `{month: '10', year: '2019'}` | | ||
| `{month: '01', year: '19'}`<br/>`{month: '1', year: '19'}`<br/>`{month: 1, year: 19}` | `{month: '01', year: '19'}` | | ||
| `{month: '10', year: '2019'}`<br/>`{month: '1', year: '2019'}`<br/>`{month: 1, year: 19}` | `{month: '10', year: '2019'}` | | ||
| Input | Output | | ||
| ------------------------------------------------------------------------------------------- | ----------------------------- | | ||
| `'10/19'`<br/>`'10 / 19'`<br />`'1019'`<br/>`'10 19'` | `{month: '10', year: '19'}` | | ||
| `'10/2019'`<br/>`'10 / 2019'`<br />`'102019'`<br/>`'10 2019'`<br/>`'10 19'` | `{month: '10', year: '2019'}` | | ||
| `'2019-10'` | `{month: '10', year: '2019'}` | | ||
| `{month: '01', year: '19'}`<br/>`{month: '1', year: '19'}`<br/>`{month: 1, year: 19}` | `{month: '01', year: '19'}` | | ||
| `{month: '01', year: '2019'}`<br/>`{month: '1', year: '2019'}`<br/>`{month: 1, year: 2019}` | `{month: '01', year: '2019'}` | | ||
- - - | ||
--- | ||
@@ -288,3 +288,3 @@ #### `valid.expirationMonth(value: string): object` | ||
- - - | ||
--- | ||
@@ -305,3 +305,3 @@ #### `valid.expirationYear(value: string, maxElapsedYear: integer): object` | ||
- - - | ||
--- | ||
@@ -319,3 +319,3 @@ #### `valid.cvv(value: string, maxLength: integer): object` | ||
- - - | ||
--- | ||
@@ -350,13 +350,11 @@ #### `valid.postalCode(value: string, [options: object]): object` | ||
valid.creditCardType.addCard({ | ||
niceType: 'NewCard', | ||
type: 'new-card', | ||
patterns: [ | ||
1234 | ||
], | ||
niceType: "NewCard", | ||
type: "new-card", | ||
patterns: [1234], | ||
gaps: [4, 8, 12], | ||
lengths: [16], | ||
code: { | ||
name: 'CVV', | ||
size: 3 | ||
} | ||
name: "CVV", | ||
size: 3, | ||
}, | ||
}); | ||
@@ -363,0 +361,0 @@ ``` |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable */ | ||
/* | ||
@@ -23,3 +24,3 @@ * Luhn algorithm implementation in JavaScript | ||
*/ | ||
'use strict'; | ||
"use strict"; | ||
@@ -26,0 +27,0 @@ function luhn10(identifier) { |
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
111225
50
3279
8
371
1
+ Addedcredit-card-type@9.1.0(transitive)
- Removedcredit-card-type@8.3.0(transitive)
Updatedcredit-card-type@^9.0.0