Skip to content

Commit

Permalink
Add support to MasterCard's 2-Series BINs
Browse files Browse the repository at this point in the history
  • Loading branch information
Risejandi Autida committed Sep 6, 2016
1 parent 9208844 commit 800dded
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/isCreditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _assertString2 = _interopRequireDefault(_assertString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/* eslint-disable max-len */
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})|62[0-9]{14}$/;
var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})|62[0-9]{14}$/;
/* eslint-enable max-len */

function isCreditCard(str) {
Expand Down Expand Up @@ -42,4 +42,4 @@ function isCreditCard(str) {
}
return !!(sum % 10 === 0 ? sanitized : false);
}
module.exports = exports['default'];
module.exports = exports['default'];
7 changes: 7 additions & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -1600,11 +1600,18 @@ describe('Validators', function () {
'6234698580215388',
'6226050967750613',
'6246281879460688',
'2222155765072228',
'2225855203075256',
'2720428011723762',
'2718760626256570'
],
invalid: [
'foo',
'foo',
'5398228707871528',
'2718760626256571',
'2721465526338453',
'2220175103860763'
],
});
});
Expand Down

0 comments on commit 800dded

Please sign in to comment.