credit-card-type
Advanced tools
Comparing version 6.2.0 to 6.3.0
@@ -0,1 +1,6 @@ | ||
6.3.0 | ||
===== | ||
- Add support for `MIR` card type (thanks @antongolub) | ||
6.2.0 | ||
@@ -2,0 +7,0 @@ ===== |
@@ -8,3 +8,3 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.creditCardType=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var VISA = 'visa'; | ||
var MASTERCARD = 'master-card'; | ||
var MASTERCARD = 'master-card'; // TODO: rename to mastercard in major version bunmp | ||
var AMERICAN_EXPRESS = 'american-express'; | ||
@@ -16,2 +16,3 @@ var DINERS_CLUB = 'diners-club'; | ||
var MAESTRO = 'maestro'; | ||
var MIR = 'mir'; | ||
var CVV = 'CVV'; | ||
@@ -21,2 +22,3 @@ var CID = 'CID'; | ||
var CVN = 'CVN'; | ||
var CVP2 = 'CVP2'; | ||
var ORIGINAL_TEST_ORDER = [ | ||
@@ -30,3 +32,4 @@ VISA, | ||
UNIONPAY, | ||
MAESTRO | ||
MAESTRO, | ||
MIR | ||
]; | ||
@@ -153,2 +156,15 @@ | ||
types[MIR] = { | ||
niceType: 'Mir', | ||
type: MIR, | ||
prefixPattern: /^(2|22|220|220[0-4])$/, | ||
exactPattern: /^(220[0-4])\d*$/, | ||
gaps: [4, 8, 12], | ||
lengths: [16, 17, 18, 19], | ||
code: { | ||
name: CVP2, | ||
size: 3 | ||
} | ||
}; | ||
function findType(type) { | ||
@@ -236,3 +252,4 @@ return customCards[type] || types[type]; | ||
UNIONPAY: UNIONPAY, | ||
MAESTRO: MAESTRO | ||
MAESTRO: MAESTRO, | ||
MIR: MIR | ||
}; | ||
@@ -239,0 +256,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.creditCardType=e()}}(function(){return function e(t,n,r){function i(o,p){if(!n[o]){if(!t[o]){var s="function"==typeof require&&require;if(!p&&s)return s(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";function r(e){var t;return e?(t=JSON.parse(JSON.stringify(e)),delete t.prefixPattern,delete t.exactPattern,t):null}function i(e){return c[e]||s[e]}function a(e){var t,n,a,o=[],s=[];if(!("string"==typeof e||e instanceof String))return[];for(a=0;a<p.length;a++)t=p[a],n=i(t),0!==e.length?n.exactPattern.test(e)?s.push(r(n)):n.prefixPattern.test(e)&&o.push(r(n)):o.push(r(n));return s.length?s:o}function o(e,t){var n=p.indexOf(e);if(!t&&n===-1)throw new Error('"'+e+'" is not a supported card type.');return n}var p,s={},c={},f="visa",d="master-card",u="american-express",y="diners-club",l="discover",x="jcb",g="unionpay",P="maestro",h="CVV",m="CID",v="CVC",C="CVN",$=[f,d,u,y,l,x,g,P];p=r($),s[f]={niceType:"Visa",type:f,prefixPattern:/^4$/,exactPattern:/^4\d*$/,gaps:[4,8,12],lengths:[16,18,19],code:{name:h,size:3}},s[d]={niceType:"Mastercard",type:d,prefixPattern:/^(5|5[1-5]|2|22|222|222[1-9]|2[3-6]|27|27[0-2]|2720)$/,exactPattern:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*$/,gaps:[4,8,12],lengths:[16],code:{name:v,size:3}},s[u]={niceType:"American Express",type:u,prefixPattern:/^(3|34|37)$/,exactPattern:/^3[47]\d*$/,isAmex:!0,gaps:[4,10],lengths:[15],code:{name:m,size:4}},s[y]={niceType:"Diners Club",type:y,prefixPattern:/^(3|3[0689]|30[0-5])$/,exactPattern:/^3(0[0-5]|[689])\d*$/,gaps:[4,10],lengths:[14,16,19],code:{name:h,size:3}},s[l]={niceType:"Discover",type:l,prefixPattern:/^(6|60|601|6011|65|64|64[4-9])$/,exactPattern:/^(6011|65|64[4-9])\d*$/,gaps:[4,8,12],lengths:[16,19],code:{name:m,size:3}},s[x]={niceType:"JCB",type:x,prefixPattern:/^(2|21|213|2131|1|18|180|1800|3|35)$/,exactPattern:/^(2131|1800|35)\d*$/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:h,size:3}},s[g]={niceType:"UnionPay",type:g,prefixPattern:/^((6|62|62\d|(621(?!83|88|98|99))|622(?!06)|627[02,06,07]|628(?!0|1)|629[1,2])|622018)$/,exactPattern:/^(((620|(621(?!83|88|98|99))|622(?!06|018)|62[3-6]|627[02,06,07]|628(?!0|1)|629[1,2]))\d*|622018\d{12})$/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:C,size:3}},s[P]={niceType:"Maestro",type:P,prefixPattern:/^(5|5[06-9]|6\d*)$/,exactPattern:/^(5[06-9]|6[37])\d*$/,gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:v,size:3}},a.getTypeInfo=function(e){return r(i(e))},a.removeCard=function(e){var t=o(e);p.splice(t,1)},a.addCard=function(e){var t=o(e.type,!0);c[e.type]=e,t===-1&&p.push(e.type)},a.changeOrder=function(e,t){var n=o(e);p.splice(n,1),p.splice(t,0,e)},a.resetModifications=function(){p=r($),c={}},a.types={VISA:f,MASTERCARD:d,AMERICAN_EXPRESS:u,DINERS_CLUB:y,DISCOVER:l,JCB:x,UNIONPAY:g,MAESTRO:P},t.exports=a},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.creditCardType=e()}}(function(){return function e(t,n,r){function i(p,s){if(!n[p]){if(!t[p]){var o="function"==typeof require&&require;if(!s&&o)return o(p,!0);if(a)return a(p,!0);var c=new Error("Cannot find module '"+p+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[p]={exports:{}};t[p][0].call(f.exports,function(e){var n=t[p][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[p].exports}for(var a="function"==typeof require&&require,p=0;p<r.length;p++)i(r[p]);return i}({1:[function(e,t,n){"use strict";function r(e){var t;return e?(t=JSON.parse(JSON.stringify(e)),delete t.prefixPattern,delete t.exactPattern,t):null}function i(e){return c[e]||o[e]}function a(e){var t,n,a,p=[],o=[];if(!("string"==typeof e||e instanceof String))return[];for(a=0;a<s.length;a++)t=s[a],n=i(t),0!==e.length?n.exactPattern.test(e)?o.push(r(n)):n.prefixPattern.test(e)&&p.push(r(n)):p.push(r(n));return o.length?o:p}function p(e,t){var n=s.indexOf(e);if(!t&&n===-1)throw new Error('"'+e+'" is not a supported card type.');return n}var s,o={},c={},f="visa",d="master-card",u="american-express",y="diners-club",l="discover",x="jcb",g="unionpay",P="maestro",h="mir",m="CVV",$="CID",v="CVC",C="CVN",T="CVP2",E=[f,d,u,y,l,x,g,P,h];s=r(E),o[f]={niceType:"Visa",type:f,prefixPattern:/^4$/,exactPattern:/^4\d*$/,gaps:[4,8,12],lengths:[16,18,19],code:{name:m,size:3}},o[d]={niceType:"Mastercard",type:d,prefixPattern:/^(5|5[1-5]|2|22|222|222[1-9]|2[3-6]|27|27[0-2]|2720)$/,exactPattern:/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[0-1]|2720)\d*$/,gaps:[4,8,12],lengths:[16],code:{name:v,size:3}},o[u]={niceType:"American Express",type:u,prefixPattern:/^(3|34|37)$/,exactPattern:/^3[47]\d*$/,isAmex:!0,gaps:[4,10],lengths:[15],code:{name:$,size:4}},o[y]={niceType:"Diners Club",type:y,prefixPattern:/^(3|3[0689]|30[0-5])$/,exactPattern:/^3(0[0-5]|[689])\d*$/,gaps:[4,10],lengths:[14,16,19],code:{name:m,size:3}},o[l]={niceType:"Discover",type:l,prefixPattern:/^(6|60|601|6011|65|64|64[4-9])$/,exactPattern:/^(6011|65|64[4-9])\d*$/,gaps:[4,8,12],lengths:[16,19],code:{name:$,size:3}},o[x]={niceType:"JCB",type:x,prefixPattern:/^(2|21|213|2131|1|18|180|1800|3|35)$/,exactPattern:/^(2131|1800|35)\d*$/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:m,size:3}},o[g]={niceType:"UnionPay",type:g,prefixPattern:/^((6|62|62\d|(621(?!83|88|98|99))|622(?!06)|627[02,06,07]|628(?!0|1)|629[1,2])|622018)$/,exactPattern:/^(((620|(621(?!83|88|98|99))|622(?!06|018)|62[3-6]|627[02,06,07]|628(?!0|1)|629[1,2]))\d*|622018\d{12})$/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:C,size:3}},o[P]={niceType:"Maestro",type:P,prefixPattern:/^(5|5[06-9]|6\d*)$/,exactPattern:/^(5[06-9]|6[37])\d*$/,gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:v,size:3}},o[h]={niceType:"Mir",type:h,prefixPattern:/^(2|22|220|220[0-4])$/,exactPattern:/^(220[0-4])\d*$/,gaps:[4,8,12],lengths:[16,17,18,19],code:{name:T,size:3}},a.getTypeInfo=function(e){return r(i(e))},a.removeCard=function(e){var t=p(e);s.splice(t,1)},a.addCard=function(e){var t=p(e.type,!0);c[e.type]=e,t===-1&&s.push(e.type)},a.changeOrder=function(e,t){var n=p(e);s.splice(n,1),s.splice(t,0,e)},a.resetModifications=function(){s=r(E),c={}},a.types={VISA:f,MASTERCARD:d,AMERICAN_EXPRESS:u,DINERS_CLUB:y,DISCOVER:l,JCB:x,UNIONPAY:g,MAESTRO:P,MIR:h},t.exports=a},{}]},{},[1])(1)}); |
23
index.js
@@ -7,3 +7,3 @@ 'use strict'; | ||
var VISA = 'visa'; | ||
var MASTERCARD = 'master-card'; | ||
var MASTERCARD = 'master-card'; // TODO: rename to mastercard in major version bunmp | ||
var AMERICAN_EXPRESS = 'american-express'; | ||
@@ -15,2 +15,3 @@ var DINERS_CLUB = 'diners-club'; | ||
var MAESTRO = 'maestro'; | ||
var MIR = 'mir'; | ||
var CVV = 'CVV'; | ||
@@ -20,2 +21,3 @@ var CID = 'CID'; | ||
var CVN = 'CVN'; | ||
var CVP2 = 'CVP2'; | ||
var ORIGINAL_TEST_ORDER = [ | ||
@@ -29,3 +31,4 @@ VISA, | ||
UNIONPAY, | ||
MAESTRO | ||
MAESTRO, | ||
MIR | ||
]; | ||
@@ -152,2 +155,15 @@ | ||
types[MIR] = { | ||
niceType: 'Mir', | ||
type: MIR, | ||
prefixPattern: /^(2|22|220|220[0-4])$/, | ||
exactPattern: /^(220[0-4])\d*$/, | ||
gaps: [4, 8, 12], | ||
lengths: [16, 17, 18, 19], | ||
code: { | ||
name: CVP2, | ||
size: 3 | ||
} | ||
}; | ||
function findType(type) { | ||
@@ -235,5 +251,6 @@ return customCards[type] || types[type]; | ||
UNIONPAY: UNIONPAY, | ||
MAESTRO: MAESTRO | ||
MAESTRO: MAESTRO, | ||
MIR: MIR | ||
}; | ||
module.exports = creditCardType; |
{ | ||
"name": "credit-card-type", | ||
"version": "6.2.0", | ||
"version": "6.3.0", | ||
"description": "A library for determining credit card type", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -68,2 +68,3 @@ Credit Card Type [![Build Status](https://travis-ci.org/braintree/credit-card-type.svg)](https://travis-ci.org/braintree/credit-card-type) [![npm version](https://badge.fury.io/js/credit-card-type.svg)](http://badge.fury.io/js/credit-card-type) [![Bower](https://badge.fury.io/bo/credit-card-type.svg)](http://badge.fury.io/bo/credit-card-type) | ||
* `MAESTRO` | ||
* `MIR` | ||
@@ -84,2 +85,3 @@ #### `code` | ||
| `Maestro` | `CVC` | 3 | | ||
| `Mir` | `CVP` | 3 | | ||
@@ -182,3 +184,4 @@ A full response for a `Visa` card will look like this: | ||
creditCardType.types.UNIONPAY, | ||
creditCardType.types.MAESTRO | ||
creditCardType.types.MAESTRO, | ||
creditCardType.types.MIR | ||
] | ||
@@ -185,0 +188,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
28121
433
242