Skip to content

Commit

Permalink
v2.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fernahh committed May 25, 2018
1 parent 774d6a5 commit a0712b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
22 changes: 10 additions & 12 deletions dist/creditcard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* creditcard.js v2.1.4
* creditcard.js v2.1.5
* Created by @ContaAzul.
*
* Licensed MIT.
Expand Down Expand Up @@ -41,9 +41,7 @@ var CreditCard = function () {

for (var i = 0; i < CREDIT_CARD_LIST.length; i++) {
var creditcard = CREDIT_CARD_LIST[i];
var regex = new RegExp(creditcard.regexpFull);

if (regex.test(number)) return creditcard.name;
if (creditcard.regexpFull.test(number)) return creditcard.name;
}

return INVALID_CARD_MESSAGE;
Expand Down Expand Up @@ -92,28 +90,28 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons

var CREDIT_CARD_LIST = [{
name: 'Elo',
regexpFull: '^(401178|401179|431274|438935|451416|457393|457631|457632|504175|627780|636297|636368|(506699|5067[0-6]\d|50677[0-8])|(50900\d|5090[1-9]\d|509[1-9]\d{2})|65003[1-3]|(65003[5-9]|65004\d|65005[0-1])|(65040[5-9]|6504[1-3]\d)|(65048[5-9]|65049\d|6505[0-2]\d|65053[0-8])|(65054[1-9]|6505[5-8]\d|65059[0-8])|(65070\d|65071[0-8])|65072[0-7]|(65090[1-9]|65091\d|650920)|(65165[2-9]|6516[6-7]\d)|(65500\d|65501\d)|(65502[1-9]|6550[3-4]\d|65505[0-8]))[0-9]{10,12}'
regexpFull: /^(401178|401179|431274|438935|451416|457393|457631|457632|504175|627780|636297|636368|(506699|5067[0-6]\d|50677[0-8])|(50900\d|5090[1-9]\d|509[1-9]\d{2})|65003[1-3]|(65003[5-9]|65004\d|65005[0-1])|(65040[5-9]|6504[1-3]\d)|(65048[5-9]|65049\d|6505[0-2]\d|65053[0-8])|(65054[1-9]|6505[5-8]\d|65059[0-8])|(65070\d|65071[0-8])|65072[0-7]|(65090[1-9]|65091\d|650920)|(65165[2-9]|6516[6-7]\d)|(65500\d|65501\d)|(65502[1-9]|6550[3-4]\d|65505[0-8]))[0-9]{10,12}/
}, {
name: 'Diners',
regexpFull: '^3(?:0[0-5]|[68][0-9])[0-9]{11}$'
regexpFull: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/
}, {
name: 'Discover',
regexpFull: '^6(?:011|5[0-9]{2}|4[4-9][0-9]{1}|(22(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[01][0-9]|92[0-5]$)[0-9]{10}$))[0-9]{12}$'
regexpFull: /^6(?:011|5[0-9]{2}|4[4-9][0-9]{1}|(22(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[01][0-9]|92[0-5]$)[0-9]{10}$))[0-9]{12}$/
}, {
name: 'Hipercard',
regexpFull: '^(38[0-9]{17}|60[0-9]{14})$'
regexpFull: /^(38[0-9]{17}|60[0-9]{14})$/
}, {
name: 'Amex',
regexpFull: '^3[47][0-9]{13}$'
regexpFull: /^3[47][0-9]{13}$/
}, {
name: 'Aura',
regexpFull: '^50[0-9]{14,17}$'
regexpFull: /^50[0-9]{14,17}$/
}, {
name: 'Mastercard',
regexpFull: '^(5[1-5][0-9]{14}|2221[0-9]{12}|222[2-9][0-9]{12}|22[3-9][0-9]{13}|2[3-6][0-9]{14}|27[01][0-9]{13}|2720[0-9]{12})$'
regexpFull: /^(5[1-5][0-9]{14}|2221[0-9]{12}|222[2-9][0-9]{12}|22[3-9][0-9]{13}|2[3-6][0-9]{14}|27[01][0-9]{13}|2720[0-9]{12})$/
}, {
name: 'Visa',
regexpFull: '^4[0-9]{12}(?:[0-9]{3})?$'
regexpFull: /^4[0-9]{12}(?:[0-9]{3})?$/
}];

var CreditCardList = function () {
Expand Down
4 changes: 2 additions & 2 deletions dist/creditcard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "creditcard.js",
"version": "2.1.4",
"version": "2.1.5",
"description": "A simple library for credit-card validation in JavaScript",
"main": "dist/creditcard.min.js",
"repository": "ContaAzul/creditcard.js",
Expand Down

0 comments on commit a0712b3

Please sign in to comment.