Skip to content

Commit 78921e6

Browse files
committed
adding Maestro credit card ranges
1 parent 9ba1735 commit 78921e6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/lib/isCreditCard.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ const cards = {
77
discover: /^6(?:011|5[0-9][0-9])[0-9]{12,15}$/,
88
jcb: /^(?:2131|1800|35\d{3})\d{11}$/,
99
mastercard: /^5[1-5][0-9]{2}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/, // /^[25][1-7][0-9]{14}$/;
10+
maestro: /^(493698|50(0[0-9]{3}|4(1[0-7][0-4]|7[6-9][0-9]))|50[678](7[789][0-9]|9[0-9]{2})|5[6-9]|63|67|6)\d{6,13}$/,
1011
unionpay: /^(6[27][0-9]{14}|^(81[0-9]{14,17}))$/,
1112
visa: /^(?:4[0-9]{12})(?:[0-9]{3,6})?$/,
1213
};
1314
/* eslint-disable max-len */
14-
const allCards = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|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,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/;
15+
const allCards = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|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,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17})|(493698|50(0[0-9]{3}|4(1[0-7][0-4]|7[6-9][0-9]))|50[678](7[789][0-9]|9[0-9]{2})|5[6-9]|63|67|6)\d{6,13})$/;
1516
/* eslint-enable max-len */
1617

1718
export default function isCreditCard(card, options = {}) {

test/validators.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5300,6 +5300,7 @@ describe('Validators', () => {
53005300
'4716989580001715211',
53015301
'8171999927660000',
53025302
'8171999900000000021',
5303+
'5899162000000000',
53035304
],
53045305
invalid: [
53055306
'foo',

0 commit comments

Comments
 (0)