Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

credit-card-type

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

credit-card-type - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

5

CHANGELOG.md

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc