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.1 to 2.2.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

2.2.2
=====
- Fixes 3-digit expiration date handling, such as 220 being Feb, 2020
2.2.1

@@ -2,0 +7,0 @@ =====

2

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

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

@@ -0,3 +1,5 @@

var expirationYear = require('./expiration-year');
function parseDate(value) {
var month, len;
var month, len, year, yearValid;

@@ -13,3 +15,12 @@ if (value.match('/')) {

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

@@ -16,0 +27,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