credit-card-type
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -0,1 +1,6 @@ | ||
4.0.3 | ||
===== | ||
- Remove behavior where some UnionPay cards displayed Discover and UnionPay as possible card types | ||
4.0.2 | ||
@@ -2,0 +7,0 @@ ===== |
23
index.js
@@ -52,3 +52,3 @@ 'use strict'; | ||
type: 'discover', | ||
pattern: discoverPattern(), | ||
pattern: '^6(0|01|011\\d*|5\\d*|4|4[4-9]\\d*)?$', | ||
gaps: [4, 8, 12], | ||
@@ -117,25 +117,4 @@ lengths: [16, 19], | ||
function unionPayAndDiscoverPattern() { | ||
var i, firstPattern, secondPattern, thirdPattern; | ||
var firstPatternBins = []; | ||
for (i = 622126; i <= 622925; i++) { firstPatternBins.push(i); } | ||
firstPattern = '^(' + firstPatternBins.join('|') + ')\\d*$'; | ||
secondPattern = '^(62[4-6])\\d*$'; | ||
thirdPattern = '^(628[2-9])\\d*$'; | ||
return [firstPattern, secondPattern, thirdPattern].join('|'); | ||
} | ||
function nonUnionPayAndDiscoverPattern() { | ||
return '(^6(0|01|011\\d*|5\\d*|4|4[4-9]\\d*)?$)'; | ||
} | ||
function discoverPattern() { | ||
return [unionPayAndDiscoverPattern(), nonUnionPayAndDiscoverPattern()].join('|'); | ||
} | ||
function clone(x) { | ||
return JSON.parse(JSON.stringify(x)); | ||
} |
{ | ||
"name": "credit-card-type", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "A library for determining credit card type", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,18 +107,16 @@ 'use strict'; | ||
['3530111333300000', 'jcb'], | ||
['3566002020360505', 'jcb'] | ||
]; | ||
['3566002020360505', 'jcb'], | ||
var dualBrandTests = [ | ||
['6221260000000000', ['discover', 'unionpay']], | ||
['6221260000000000000', ['discover', 'unionpay']], | ||
['6222000000000000', ['discover', 'unionpay']], | ||
['6228000000000000', ['discover', 'unionpay']], | ||
['6229250000000000', ['discover', 'unionpay']], | ||
['6229250000000000000', ['discover', 'unionpay']], | ||
['6240000000000000', ['discover', 'unionpay']], | ||
['6260000000000000000', ['discover', 'unionpay']], | ||
['6282000000000000', ['discover', 'unionpay']], | ||
['6289000000000000000', ['discover', 'unionpay']], | ||
['6221558812340000', ['discover', 'unionpay']], | ||
['6269992058134322', ['discover', 'unionpay']] | ||
['6221260000000000', 'unionpay'], | ||
['6221260000000000000', 'unionpay'], | ||
['6222000000000000', 'unionpay'], | ||
['6228000000000000', 'unionpay'], | ||
['6229250000000000', 'unionpay'], | ||
['6229250000000000000', 'unionpay'], | ||
['6240000000000000', 'unionpay'], | ||
['6260000000000000000', 'unionpay'], | ||
['6282000000000000', 'unionpay'], | ||
['6289000000000000000', 'unionpay'], | ||
['6221558812340000', 'unionpay'], | ||
['6269992058134322', 'unionpay'] | ||
]; | ||
@@ -137,15 +135,2 @@ | ||
}); | ||
dualBrandTests.forEach(function (test) { | ||
var number = test[0]; | ||
var types = test[1]; | ||
it('returns type ' + types.join(', ') + ' for ' + number, function () { | ||
var actual = getCardType(number); | ||
expect(actual).to.have.lengthOf(2); | ||
expect(actual[0].type).to.equal(types[0]); | ||
expect(actual[1].type).to.equal(types[1]); | ||
}); | ||
}); | ||
}); | ||
@@ -152,0 +137,0 @@ |
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
18343
439