credit-card-type
Advanced tools
Comparing version 8.2.0 to 8.3.0
@@ -0,1 +1,6 @@ | ||
8.3.0 | ||
===== | ||
- Add support for series 8 UnionPay cards (fixes #95 thanks @leebradley) | ||
8.2.0 | ||
@@ -2,0 +7,0 @@ ===== |
@@ -1,2 +0,2 @@ | ||
!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){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.creditCardType = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -509,2 +509,2 @@ | ||
},{}]},{},[1])(1) | ||
}); | ||
}); |
@@ -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(a,o){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(s)return s(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return i(n?n:e)},u,u.exports,e,t,n,r)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";function r(e){return l[e]||c[e]}function i(){return o.map(function(e){return p(r(e))})}function s(e,t){var n=o.indexOf(e);if(!t&&n===-1)throw new Error('"'+e+'" is not a supported card type.');return n}function a(e){var t,n=[];return f(e)?0===e.length?i(o):(o.forEach(function(t){var i=r(t);d(e,i,n)}),t=u(n),t?[t]:n):[]}var o,c=e("./lib/card-types"),p=e("./lib/clone"),u=e("./lib/find-best-match"),f=e("./lib/is-valid-input-type"),d=e("./lib/add-matching-cards-to-results"),l={},y={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},g=[y.VISA,y.MASTERCARD,y.AMERICAN_EXPRESS,y.DINERS_CLUB,y.DISCOVER,y.JCB,y.UNIONPAY,y.MAESTRO,y.ELO,y.MIR,y.HIPER,y.HIPERCARD];o=p(g),a.getTypeInfo=function(e){return p(r(e))},a.removeCard=function(e){var t=s(e);o.splice(t,1)},a.addCard=function(e){var t=s(e.type,!0);l[e.type]=e,t===-1&&o.push(e.type)},a.updateCard=function(e,t){var n,r=l[e]||c[e];if(!r)throw new Error('"'+e+'" is not a recognized type. Use `addCard` instead.');if(t.type&&r.type!==t.type)throw new Error("Cannot overwrite type parameter.");n=p(r,!0),Object.keys(n).forEach(function(e){t[e]&&(n[e]=t[e])}),l[n.type]=n},a.changeOrder=function(e,t){var n=s(e);o.splice(n,1),o.splice(t,0,e)},a.resetModifications=function(){o=p(g),l={}},a.types=y,t.exports=a},{"./lib/add-matching-cards-to-results":2,"./lib/card-types":3,"./lib/clone":4,"./lib/find-best-match":5,"./lib/is-valid-input-type":6}],2:[function(e,t,n){"use strict";function r(e,t,n){var r,a,o,c;for(r=0;r<t.patterns.length;r++)if(a=t.patterns[r],s(e,a)){c=i(t),o=Array.isArray(a)?String(a[0]).length:String(a).length,e.length>=o&&(c.matchStrength=o),n.push(c);break}}var i=e("./clone"),s=e("./matches");t.exports=r},{"./clone":4,"./matches":7}],3:[function(e,t,n){"use strict";var r={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}};t.exports=r},{}],4:[function(e,t,n){"use strict";function r(e){var t;return e?t=JSON.parse(JSON.stringify(e)):null}t.exports=r},{}],5:[function(e,t,n){"use strict";function r(e){var t=e.filter(function(e){return e.matchStrength}).length;return t>0&&t===e.length}function i(e){if(r(e))return e.reduce(function(e,t){return e?e.matchStrength<t.matchStrength?t:e:t})}t.exports=i},{}],6:[function(e,t,n){"use strict";function r(e){return"string"==typeof e||e instanceof String}t.exports=r},{}],7:[function(e,t,n){"use strict";function r(e,t,n){var r=String(t).length,i=e.substr(0,r),s=parseInt(i,10);return t=parseInt(String(t).substr(0,i.length),10),n=parseInt(String(n).substr(0,i.length),10),s>=t&&s<=n}function i(e,t){return t=String(t),t.substring(0,e.length)===e.substring(0,t.length)}function s(e,t){return Array.isArray(t)?r(e,t[0],t[1]):i(e,t)}t.exports=s},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).creditCardType=e()}}(function(){return function s(a,o,c){function p(t,e){if(!o[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(u)return u(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var i=o[t]={exports:{}};a[t][0].call(i.exports,function(e){return p(a[t][1][e]||e)},i,i.exports,s,a,o,c)}return o[t].exports}for(var u="function"==typeof require&&require,e=0;e<c.length;e++)p(c[e]);return p}({1:[function(e,t){"use strict";var i,s=e("./lib/card-types"),a=e("./lib/clone"),o=e("./lib/find-best-match"),c=e("./lib/is-valid-input-type"),p=e("./lib/add-matching-cards-to-results"),u={},n={VISA:"visa",MASTERCARD:"mastercard",AMERICAN_EXPRESS:"american-express",DINERS_CLUB:"diners-club",DISCOVER:"discover",JCB:"jcb",UNIONPAY:"unionpay",MAESTRO:"maestro",ELO:"elo",MIR:"mir",HIPER:"hiper",HIPERCARD:"hipercard"},r=[n.VISA,n.MASTERCARD,n.AMERICAN_EXPRESS,n.DINERS_CLUB,n.DISCOVER,n.JCB,n.UNIONPAY,n.MAESTRO,n.ELO,n.MIR,n.HIPER,n.HIPERCARD];function f(e){return u[e]||s[e]}function d(e,t){var n=i.indexOf(e);if(!t&&-1===n)throw new Error('"'+e+'" is not a supported card type.');return n}function l(n){var e,r=[];return c(n)?0===n.length?i.map(function(e){return a(f(e))}):(i.forEach(function(e){var t=f(e);p(n,t,r)}),(e=o(r))?[e]:r):[]}i=a(r),l.getTypeInfo=function(e){return a(f(e))},l.removeCard=function(e){var t=d(e);i.splice(t,1)},l.addCard=function(e){var t=d(e.type,!0);u[e.type]=e,-1===t&&i.push(e.type)},l.updateCard=function(e,t){var n,r=u[e]||s[e];if(!r)throw new Error('"'+e+'" is not a recognized type. Use `addCard` instead.');if(t.type&&r.type!==t.type)throw new Error("Cannot overwrite type parameter.");n=a(r,!0),Object.keys(n).forEach(function(e){t[e]&&(n[e]=t[e])}),u[n.type]=n},l.changeOrder=function(e,t){var n=d(e);i.splice(n,1),i.splice(t,0,e)},l.resetModifications=function(){i=a(r),u={}},l.types=n,t.exports=l},{"./lib/add-matching-cards-to-results":2,"./lib/card-types":3,"./lib/clone":4,"./lib/find-best-match":5,"./lib/is-valid-input-type":6}],2:[function(e,t){"use strict";var o=e("./clone"),c=e("./matches");t.exports=function(e,t,n){var r,i,s,a;for(r=0;r<t.patterns.length;r++)if(i=t.patterns[r],c(e,i)){a=o(t),s=Array.isArray(i)?String(i[0]).length:String(i).length,e.length>=s&&(a.matchStrength=s),n.push(a);break}}},{"./clone":4,"./matches":7}],3:[function(e,t){"use strict";t.exports={visa:{niceType:"Visa",type:"visa",patterns:[4],gaps:[4,8,12],lengths:[16,18,19],code:{name:"CVV",size:3}},mastercard:{niceType:"Mastercard",type:"mastercard",patterns:[[51,55],[2221,2229],[223,229],[23,26],[270,271],2720],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},"american-express":{niceType:"American Express",type:"american-express",patterns:[34,37],gaps:[4,10],lengths:[15],code:{name:"CID",size:4}},"diners-club":{niceType:"Diners Club",type:"diners-club",patterns:[[300,305],36,38,39],gaps:[4,10],lengths:[14,16,19],code:{name:"CVV",size:3}},discover:{niceType:"Discover",type:"discover",patterns:[6011,[644,649],65],gaps:[4,8,12],lengths:[16,19],code:{name:"CID",size:3}},jcb:{niceType:"JCB",type:"jcb",patterns:[2131,1800,[3528,3589]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVV",size:3}},unionpay:{niceType:"UnionPay",type:"unionpay",patterns:[620,[624,626],[62100,62182],[62184,62187],[62185,62197],[62200,62205],[622010,622999],622018,[622019,622999],[62207,62209],[622126,622925],[623,626],6270,6272,6276,[627700,627779],[627781,627799],[6282,6289],6291,6292],gaps:[4,8,12],lengths:[14,15,16,17,18,19],code:{name:"CVN",size:3}},maestro:{niceType:"Maestro",type:"maestro",patterns:[493698,[5e5,506698],[506779,508999],[56,59],63,67,6],gaps:[4,8,12],lengths:[12,13,14,15,16,17,18,19],code:{name:"CVC",size:3}},elo:{niceType:"Elo",type:"elo",patterns:[401178,401179,438935,457631,457632,431274,451416,457393,504175,[506699,506778],[509e3,509999],627780,636297,636368,[650031,650033],[650035,650051],[650405,650439],[650485,650538],[650541,650598],[650700,650718],[650720,650727],[650901,650978],[651652,651679],[655e3,655019],[655021,655058]],gaps:[4,8,12],lengths:[16],code:{name:"CVE",size:3}},mir:{niceType:"Mir",type:"mir",patterns:[[2200,2204]],gaps:[4,8,12],lengths:[16,17,18,19],code:{name:"CVP2",size:3}},hiper:{niceType:"Hiper",type:"hiper",patterns:[637095,637568,637599,637609,637612],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}},hipercard:{niceType:"Hipercard",type:"hipercard",patterns:[606282],gaps:[4,8,12],lengths:[16],code:{name:"CVC",size:3}}}},{}],4:[function(e,t){"use strict";t.exports=function(e){return e?JSON.parse(JSON.stringify(e)):null}},{}],5:[function(e,t){"use strict";t.exports=function(e){if(function(e){var t=e.filter(function(e){return e.matchStrength}).length;return 0<t&&t===e.length}(e))return e.reduce(function(e,t){return e?e.matchStrength<t.matchStrength?t:e:t})}},{}],6:[function(e,t){"use strict";t.exports=function(e){return"string"==typeof e||e instanceof String}},{}],7:[function(e,t){"use strict";t.exports=function(e,t){return Array.isArray(t)?function(e,t,n){var r=String(t).length,i=e.substr(0,r),s=parseInt(i,10);return t=parseInt(String(t).substr(0,i.length),10),n=parseInt(String(n).substr(0,i.length),10),t<=s&&s<=n}(e,t[0],t[1]):function(e,t){return(t=String(t)).substring(0,e.length)===e.substring(0,t.length)}(e,t)}},{}]},{},[1])(1)}); |
@@ -118,3 +118,8 @@ 'use strict'; | ||
6291, | ||
6292 | ||
6292, | ||
810, | ||
[8110, 8131], | ||
[8132, 8151], | ||
[8152, 8163], | ||
[8164, 8171] | ||
], | ||
@@ -121,0 +126,0 @@ gaps: [4, 8, 12], |
{ | ||
"name": "credit-card-type", | ||
"version": "8.2.0", | ||
"version": "8.3.0", | ||
"description": "A library for determining credit card type", | ||
@@ -20,15 +20,15 @@ "main": "index.js", | ||
"devDependencies": { | ||
"browserify": "^6.1.0", | ||
"chai": "^2.1.2", | ||
"del": "^1.1.0", | ||
"eslint": "2.7.0", | ||
"eslint-config-braintree": "1.0.0", | ||
"gulp": "^3.8.8", | ||
"browserify": "^16.5.0", | ||
"chai": "^4.2.0", | ||
"del": "^5.1.0", | ||
"eslint": "^6.3.0", | ||
"eslint-config-braintree": "^4.0.0", | ||
"gulp": "^4.0.2", | ||
"gulp-rename": "^1.2.0", | ||
"gulp-size": "^1.1.0", | ||
"gulp-streamify": "0.0.5", | ||
"gulp-uglify": "^1.0.2", | ||
"mocha": "^3.0.0", | ||
"vinyl-source-stream": "^1.0.0" | ||
"gulp-size": "^3.0.0", | ||
"gulp-streamify": "^1.0.2", | ||
"gulp-uglify": "^3.0.2", | ||
"mocha": "^6.2.0", | ||
"vinyl-source-stream": "^2.0.0" | ||
} | ||
} |
@@ -87,3 +87,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` | `CVC` | 3 | | ||
| `Mir` | `CVP` | 3 | | ||
| `Mir` | `CVP2` | 3 | | ||
| `Elo` | `CVE` | 3 | | ||
@@ -175,3 +175,3 @@ | `Hiper` | `CVC` | 3 | | ||
patterns: [ | ||
41111 | ||
41111, | ||
[44, 47] | ||
@@ -178,0 +178,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
43198
867