diff --git a/bower.json b/bower.json index 6185d17..be4a57d 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "creditcard.js", "description": "A simple library for credit-card validation in JavaScript", "main": "dist/creditcard.min.js", - "version": "2.0.2", + "version": "2.0.3", "authors": [ "@ContaAzul" ], diff --git a/dist/creditcard.js b/dist/creditcard.js index 62dd3ef..60e25fd 100644 --- a/dist/creditcard.js +++ b/dist/creditcard.js @@ -1,5 +1,5 @@ /*! - * creditcard.js v2.0.2 + * creditcard.js v2.0.3 * Created by @ContaAzul. * * Licensed MIT. @@ -56,18 +56,15 @@ var CreditCard = function () { var numberLength = undefined; numberLength = brand === 'Amex' ? 4 : 3; - var regex = new RegExp('[0-9]{' + numberLength + '}'); + var regex = new RegExp('^[0-9]{' + numberLength + '}$'); - return code.length === numberLength && regex.test(code); + return regex.test(code); } }, { key: 'isExpirationDateValid', value: function isExpirationDateValid(month, year) { var m = month; var y = year; - var yearLength = y.length; - - if (yearLength < 2 && yearLength > 4) return false; m = parseInt(m, 10); y = parseInt(y, 10); diff --git a/dist/creditcard.min.js b/dist/creditcard.min.js index f679e05..045ad75 100644 --- a/dist/creditcard.min.js +++ b/dist/creditcard.min.js @@ -1,7 +1,7 @@ /*! - * creditcard.js v2.0.2 + * creditcard.js v2.0.3 * Created by @ContaAzul. * * Licensed MIT. */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.CreditCard=e()}}(function(){var e,r,n;return function e(r,n,t){function i(a,o){if(!n[a]){if(!r[a]){var l="function"==typeof require&&require;if(!o&&l)return l(a,!0);if(u)return u(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[a]={exports:{}};r[a][0].call(s.exports,function(e){var n=r[a][1][e];return i(n?n:e)},s,s.exports,e,r,n,t)}return n[a].exports}for(var u="function"==typeof require&&require,a=0;au&&u>4?!1:(t=parseInt(t,10),i=parseInt(i,10),1>t||t>12?!1:!(1e3>i||i>=3e3))}}]),e}();r.exports=o},{"./creditCardList":2,"./helpers/luhn":3}],2:[function(e,r,n){"use strict";function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,r){for(var n=0;n0&&i%10===0}}]),e}();r.exports=u},{}]},{},[1])(1)}); \ No newline at end of file +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.CreditCard=e()}}(function(){var e,r,n;return function e(r,n,t){function i(a,o){if(!n[a]){if(!r[a]){var l="function"==typeof require&&require;if(!o&&l)return l(a,!0);if(u)return u(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var s=n[a]={exports:{}};r[a][0].call(s.exports,function(e){var n=r[a][1][e];return i(n?n:e)},s,s.exports,e,r,n,t)}return n[a].exports}for(var u="function"==typeof require&&require,a=0;at||t>12?!1:!(1e3>i||i>=3e3)}}]),e}();r.exports=o},{"./creditCardList":2,"./helpers/luhn":3}],2:[function(e,r,n){"use strict";function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,r){for(var n=0;n0&&i%10===0}}]),e}();r.exports=u},{}]},{},[1])(1)}); \ No newline at end of file diff --git a/package.json b/package.json index b650571..5803aa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "creditcard.js", - "version": "2.0.2", + "version": "2.0.3", "description": "A simple library for credit-card validation in JavaScript", "main": "dist/creditcard.min.js", "repository": "ContaAzul/creditcard.js",