Skip to content

Commit

Permalink
fix(formatCardNumber): fix off by one error the other way
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepollak committed Aug 1, 2016
1 parent a986f54 commit 19f58cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ var payment =
}
upperLength = card.length[card.length.length - 1];
num = num.replace(/\D/g, '');
num = num.slice(0, +upperLength + 1 || 9e9);
num = num.slice(0, upperLength);
if (card.format.global) {
return (ref = num.match(card.format)) != null ? ref.join(' ') : void 0;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ class Payment
upperLength = card.length[card.length.length - 1]

num = num.replace(/\D/g, '')
num = num.slice(0, upperLength - 1)
num = num.slice(0, upperLength)

if card.format.global
num.match(card.format)?.join(' ')
Expand Down

0 comments on commit 19f58cd

Please sign in to comment.