diff --git a/dist/validator.js b/dist/validator.js index 4527811..b391439 100644 --- a/dist/validator.js +++ b/dist/validator.js @@ -21,5 +21,5 @@ if(!t)throw"Expiry should not be empty" this.card||this.validateCard(),this.month&&this.year||this.setBaseDate(this.month,this.year) var a=t&&t.toString().split("/")||[void 0,void 0] if(!a[0]||!a[1]||isNaN(a[0])||isNaN(a[1]))throw"Expiry should be in MM/YYYY format" -return!(a&&2==a.length&&a[1]==this.year&&a[0]0&&parseInt(a[0])<13&&parseInt(a[1])>=this.year)},this}var __indexOf=[].indexOf,cardTypes=[{name:"amex",pattern:/^3[47]/,valid_length:[15],cvv_length:[4]},{name:"diners_club_carte_blanche",pattern:/^30[0-5]/,valid_length:[14],cvv_length:[3]},{name:"diners_club_international",pattern:/^36/,valid_length:[14],cvv_length:[3]},{name:"jcb",pattern:/^35(2[89]|[3-8][0-9])/,valid_length:[16],cvv_length:[3]},{name:"laser",pattern:/^(6304|670[69]|6771)/,valid_length:[16,17,18,19]},{name:"visa_electron",pattern:/^(4026|417500|4508|4844|491(3|7))/,valid_length:[16],cvv_length:[3]},{name:"visa",pattern:/^4/,valid_length:[16],cvv_length:[3]},{name:"mastercard",pattern:/^5[1-5]/,valid_length:[16],cvv_length:[3]},{name:"maestro",pattern:/^(5018|5081|5044|5020|5038|603845|6304|6759|676[1-3]|6220|504834|504817|504645)\d*/,valid_length:[12,13,14,15,16,17,18,19],cvv_length:[0,3]},{name:"discover",pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,valid_length:[16],cvv_length:[3]},{name:"rupay",range:[[508500,508999],[606985,607984],[608001,608100],[608101,608500],[652150,653149]],valid_length:[16],cvv_length:[3]}] +return!(a&&2==a.length&&a[1]==this.year&&a[0]0&&parseInt(a[0])<13&&parseInt(a[1])>=this.year)},this}var __indexOf=[].indexOf,cardTypes=[{name:"amex",pattern:/^3[47]/,valid_length:[15],cvv_length:[4]},{name:"diners_club_carte_blanche",pattern:/^30[0-5]/,valid_length:[14],cvv_length:[3]},{name:"diners_club_international",pattern:/^36/,valid_length:[14],cvv_length:[3]},{name:"jcb",pattern:/^35(2[89]|[3-8][0-9])/,valid_length:[16],cvv_length:[3]},{name:"laser",pattern:/^(6304|670[69]|6771)/,valid_length:[16,17,18,19]},{name:"visa_electron",pattern:/^(4026|417500|4508|4844|491(3|7))/,valid_length:[16],cvv_length:[3]},{name:"visa",pattern:/^4/,valid_length:[16],cvv_length:[3]},{name:"mastercard",pattern:/^5[1-5]/,valid_length:[16],cvv_length:[3]},{name:"maestro",pattern:/^(5018|5081|5044|5020|5038|603845|6304|6759|676[1-3]|6220|504834|504817|504645)\d*/,valid_length:[12,13,14,15,16,17,18,19],cvv_length:[0,3]},{name:"rupay",range:[[[508500,508999],[606985,607384],[607385,607484],[607485,607984],[608001,608100],[608101,608200],[608201,608300],[608301,608350],[608351,608500],[652150,652849],[652850,653049],[653050,653149]]],valid_length:[16],cvv_length:[3]},{name:"discover",pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,valid_length:[16],cvv_length:[3]}] module.exports=cardValidator diff --git a/package.json b/package.json index a6ef4ef..2733ff5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-card-validator", - "version": "1.0.6", + "version": "1.0.7", "description": "Card validation helpers for card number, expiry and CVV.", "main": "index.js", "scripts": { diff --git a/src/validator.js b/src/validator.js index 7a8f2a3..67cbc85 100644 --- a/src/validator.js +++ b/src/validator.js @@ -45,22 +45,30 @@ var cardTypes = [ pattern: /^(5018|5081|5044|5020|5038|603845|6304|6759|676[1-3]|6220|504834|504817|504645)\d*/, valid_length: [12, 13, 14, 15, 16, 17, 18, 19], cvv_length: [0, 3] - }, { - name: 'discover', - pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/, - valid_length: [16], - cvv_length: [3] }, { name: 'rupay', range: [ - [508500, 508999], - [606985, 607984], - [608001, 608100], - [608101, 608500], - [652150, 653149] + [ [508500,508999], + [606985,607384], + [607385,607484], + [607485,607984], + [608001,608100], + [608101,608200], + [608201,608300], + [608301,608350], + [608351,608500], + [652150,652849], + [652850,653049], + [653050,653149]] ], valid_length: [16], cvv_length: [3] + }, + { + name: 'discover', + pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/, + valid_length: [16], + cvv_length: [3] } ];