Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

card-validator

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

card-validator - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

7

CHANGELOG.md

@@ -0,1 +1,8 @@

2.2.4
=====
- Fixes validation of space separated expiration dates
- Fixes potential validity of slashless expiration dates
- Fixes validation of expiration dates that are too long
2.2.3

@@ -2,0 +9,0 @@ =====

2

package.json
{
"name": "card-validator",
"version": "2.2.3",
"version": "2.2.4",
"description": "A library for validating credit card fields",

@@ -5,0 +5,0 @@ "main": "index.js",

var expirationYear = require('./expiration-year');
var isArray = require('lodash/lang/isArray');

@@ -6,5 +7,9 @@ function parseDate(value) {

if (value.match('/')) {
if (/\//.test(value)) {
value = value.split(/\s*\/\s*/g);
} else if (/\s/.test(value)) {
value = value.split(/ +/g);
}
if (isArray(value)) {
return {

@@ -16,8 +21,8 @@ month: value[0],

len = value[0] === '0' || value.length > 5 || value.length === 4 ? 2 : 1;
len = value[0] === '0' || value.length > 5 ? 2 : 1;
if (value.length === 3 && value[0] === '1') {
year = value.substr(1, 2);
if (value[0] === '1') {
year = value.substr(1);
yearValid = expirationYear(year);
if (!yearValid.isValid) {
if (!yearValid.isPotentiallyValid) {
len = 2;

@@ -31,3 +36,3 @@ }

month: month,
year: value.substr(month.length, 4)
year: value.substr(month.length)
};

@@ -34,0 +39,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc