Skip to content

Commit

Permalink
[ISSUE-294] Enable 19 digits for all credit card with strict mode (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
nosir authored Mar 16, 2018
1 parent 59f125d commit 9a5c004
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 58 deletions.
2 changes: 2 additions & 0 deletions ISSUE_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
To reproduce the error or describe your requirement with a jsfiddle url would be appreciated:
- Fork this with vanilla JS component: https://jsfiddle.net/nosir/kbaxx64s/
- Fork this with React JS component: https://jsfiddle.net/nosir/gLLsrxxf/

If it's mobile related, please specify your device and environment.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"form",
"input"
],
"version": "1.1.4",
"version": "1.1.5",
"author": {
"name": "Max Huang",
"email": "[email protected]",
Expand Down
20 changes: 8 additions & 12 deletions dist/cleave-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ return /******/ (function(modules) { // webpackBootstrap
maestro: [4, 4, 4, 4],
visa: [4, 4, 4, 4],
mir: [4, 4, 4, 4],
general: [4, 4, 4, 4],
unionPay: [4, 4, 4, 4],
general: [4, 4, 4, 4],
generalStrict: [4, 4, 4, 7]
},

Expand Down Expand Up @@ -859,7 +859,7 @@ return /******/ (function(modules) { // webpackBootstrap

// starts with 50/56-58/6304/67; 16 digits
maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,

// starts with 22; 16 digits
mir: /^220[0-4]\d{0,12}/,

Expand All @@ -874,26 +874,22 @@ return /******/ (function(modules) { // webpackBootstrap
var blocks = CreditCardDetector.blocks,
re = CreditCardDetector.re;

// In theory, visa credit card can have up to 19 digits number.
// Some credit card can have up to 19 digits number.
// Set strictMode to true will remove the 16 max-length restrain,
// however, I never found any website validate card number like
// this, hence probably you don't need to enable this option.
// this, hence probably you don't want to enable this option.
strictMode = !!strictMode;

for (var key in re) {
if (re[key].test(value)) {
var block;
if (
key === 'discover' ||
key === 'maestro' ||
key === 'visa' ||
key === 'mir' ||
key === 'unionPay'
) {
block = strictMode ? blocks.generalStrict : blocks[key];

if (strictMode) {
block = blocks.generalStrict;
} else {
block = blocks[key];
}

return {
type: key,
blocks: block
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-angular.min.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions dist/cleave-react-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2081,8 +2081,8 @@ return /******/ (function(modules) { // webpackBootstrap
maestro: [4, 4, 4, 4],
visa: [4, 4, 4, 4],
mir: [4, 4, 4, 4],
general: [4, 4, 4, 4],
unionPay: [4, 4, 4, 4],
general: [4, 4, 4, 4],
generalStrict: [4, 4, 4, 7]
},

Expand Down Expand Up @@ -2128,20 +2128,22 @@ return /******/ (function(modules) { // webpackBootstrap
var blocks = CreditCardDetector.blocks,
re = CreditCardDetector.re;

// In theory, visa credit card can have up to 19 digits number.
// Some credit card can have up to 19 digits number.
// Set strictMode to true will remove the 16 max-length restrain,
// however, I never found any website validate card number like
// this, hence probably you don't need to enable this option.
// this, hence probably you don't want to enable this option.
strictMode = !!strictMode;

for (var key in re) {
if (re[key].test(value)) {
var block;
if (key === 'discover' || key === 'maestro' || key === 'visa' || key === 'mir' || key === 'unionPay') {
block = strictMode ? blocks.generalStrict : blocks[key];

if (strictMode) {
block = blocks.generalStrict;
} else {
block = blocks[key];
}

return {
type: key,
blocks: block
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-react-node.min.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions dist/cleave-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -2275,8 +2275,8 @@ return /******/ (function(modules) { // webpackBootstrap
maestro: [4, 4, 4, 4],
visa: [4, 4, 4, 4],
mir: [4, 4, 4, 4],
general: [4, 4, 4, 4],
unionPay: [4, 4, 4, 4],
general: [4, 4, 4, 4],
generalStrict: [4, 4, 4, 7]
},

Expand Down Expand Up @@ -2322,20 +2322,22 @@ return /******/ (function(modules) { // webpackBootstrap
var blocks = CreditCardDetector.blocks,
re = CreditCardDetector.re;

// In theory, visa credit card can have up to 19 digits number.
// Some credit card can have up to 19 digits number.
// Set strictMode to true will remove the 16 max-length restrain,
// however, I never found any website validate card number like
// this, hence probably you don't need to enable this option.
// this, hence probably you don't want to enable this option.
strictMode = !!strictMode;

for (var key in re) {
if (re[key].test(value)) {
var block;
if (key === 'discover' || key === 'maestro' || key === 'visa' || key === 'mir' || key === 'unionPay') {
block = strictMode ? blocks.generalStrict : blocks[key];

if (strictMode) {
block = blocks.generalStrict;
} else {
block = blocks[key];
}

return {
type: key,
blocks: block
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-react.min.js

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions dist/cleave.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,8 @@ return /******/ (function(modules) { // webpackBootstrap
maestro: [4, 4, 4, 4],
visa: [4, 4, 4, 4],
mir: [4, 4, 4, 4],
general: [4, 4, 4, 4],
unionPay: [4, 4, 4, 4],
general: [4, 4, 4, 4],
generalStrict: [4, 4, 4, 7]
},

Expand Down Expand Up @@ -859,7 +859,7 @@ return /******/ (function(modules) { // webpackBootstrap

// starts with 50/56-58/6304/67; 16 digits
maestro: /^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,

// starts with 22; 16 digits
mir: /^220[0-4]\d{0,12}/,

Expand All @@ -874,26 +874,22 @@ return /******/ (function(modules) { // webpackBootstrap
var blocks = CreditCardDetector.blocks,
re = CreditCardDetector.re;

// In theory, visa credit card can have up to 19 digits number.
// Some credit card can have up to 19 digits number.
// Set strictMode to true will remove the 16 max-length restrain,
// however, I never found any website validate card number like
// this, hence probably you don't need to enable this option.
// this, hence probably you don't want to enable this option.
strictMode = !!strictMode;

for (var key in re) {
if (re[key].test(value)) {
var block;
if (
key === 'discover' ||
key === 'maestro' ||
key === 'visa' ||
key === 'mir' ||
key === 'unionPay'
) {
block = strictMode ? blocks.generalStrict : blocks[key];

if (strictMode) {
block = blocks.generalStrict;
} else {
block = blocks[key];
}

return {
type: key,
blocks: block
Expand Down
Loading

0 comments on commit 9a5c004

Please sign in to comment.