Socket
Socket
Sign inDemoInstall

card-validator

Package Overview
Dependencies
1
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.1.0 to 8.1.1

.github/CODEOWNERS

4

CHANGELOG.md

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

# 8.1.1
- Fix issue where a potentially valid year would evaulate as invalid (#93)
# 8.1.0

@@ -2,0 +6,0 @@

@@ -42,2 +42,5 @@ "use strict";

if (len === 2) {
if (String(currentYear).substr(0, 2) === value) {
return verification(false, true);
}
isCurrentYear = twoDigitYear === numericValue;

@@ -44,0 +47,0 @@ valid =

2

dist/index.js

@@ -17,3 +17,3 @@ "use strict";

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -20,0 +20,0 @@ return result;

{
"name": "card-validator",
"version": "8.1.0",
"version": "8.1.1",
"description": "A library for validating credit card fields",

@@ -23,13 +23,13 @@ "main": "dist/index.js",

"devDependencies": {
"@types/jest": "^26.0.5",
"@types/node": "^14.0.24",
"eslint": "^7.5.0",
"eslint-config-braintree": "^5.0.0-typescript-prep-rc.17",
"jest": "^26.1.0",
"prettier": "^2.0.5",
"ts-jest": "^26.1.3",
"typescript": "^3.9.7"
"@types/jest": "^26.0.23",
"@types/node": "^15.0.2",
"eslint": "^7.26.0",
"eslint-config-braintree": "^5.0.0-typescript-prep-rc.18",
"jest": "^26.6.3",
"prettier": "^2.3.0",
"ts-jest": "^26.5.6",
"typescript": "^4.2.4"
},
"dependencies": {
"credit-card-type": "^9.0.0"
"credit-card-type": "^9.1.0"
},

@@ -40,3 +40,3 @@ "jest": {

"ts-jest": {
"tsConfig": "src/__tests__/tsconfig.json"
"tsconfig": "src/__tests__/tsconfig.json"
}

@@ -43,0 +43,0 @@ }

@@ -1,2 +0,2 @@

# Credit Card Validator [![Build Status](https://travis-ci.org/braintree/card-validator.svg)](https://travis-ci.org/braintree/card-validator) [![npm version](https://badge.fury.io/js/card-validator.svg)](http://badge.fury.io/js/card-validator)
# Credit Card Validator [![Build Status](https://github.com/braintree/card-validator/workflows/Unit%20Tests/badge.svg)](https://github.com/braintree/card-validator/actions?query=workflow%3A%22Unit+Tests%22) [![npm version](https://badge.fury.io/js/card-validator.svg)](http://badge.fury.io/js/card-validator)

@@ -3,0 +3,0 @@ Credit Card Validator provides validation utilities for credit card data inputs. It is designed as a CommonJS module for use in Node.js, io.js, or the [browser](http://browserify.org/). It includes first class support for 'potential' validity so you can use it to present appropriate UI to your user as they type.

import { cvv } from "../cvv";
import { Verification } from "../types";

@@ -61,16 +60,13 @@ describe("cvv", () => {

],
] as Array<[string, Array<[string, Verification, (Function | number)?]>]>)(
"%s",
(description, tests) => {
it.each(tests)("parses %s to be %p", (testCvv, meta, maxLength) => {
if (typeof maxLength === "function") {
// maxLength argument got converted to a done callback
expect(cvv(testCvv)).toEqual(meta);
maxLength();
} else {
expect(cvv(testCvv, maxLength)).toEqual(meta);
}
});
}
);
])("%s", (description, tests) => {
it.each(tests)("parses %s to be %p", (testCvv, meta, maxLength) => {
if (typeof maxLength === "function") {
// maxLength argument got converted to a done callback
expect(cvv(testCvv)).toEqual(meta);
maxLength();
} else {
expect(cvv(testCvv, maxLength)).toEqual(meta);
}
});
});
});

@@ -77,0 +73,0 @@

@@ -6,2 +6,3 @@ import { expirationDate, ExpirationDateVerification } from "../expiration-date";

const twoDigitYear = Number(String(currentYear).substr(2, 2));
const firstTwoDigitsOfCurrentYear = Number(String(currentYear).substr(0, 2));
const nextYear = currentYear + 1;

@@ -387,2 +388,11 @@ const currentMonth = date.getMonth() + 1;

],
[
`02/${firstTwoDigitsOfCurrentYear}`,
{
isValid: false,
isPotentiallyValid: true,
month: null,
year: null,
},
],
],

@@ -601,2 +611,6 @@ ],

[
`1 ${firstTwoDigitsOfCurrentYear}`,
{ isValid: false, isPotentiallyValid: true, month: null, year: null },
],
[
"1 ",

@@ -795,2 +809,6 @@ { isValid: false, isPotentiallyValid: true, month: null, year: null },

],
[
`02${firstTwoDigitsOfCurrentYear}`,
{ isValid: false, isPotentiallyValid: true, month: null, year: null },
],
],

@@ -1224,2 +1242,11 @@ ],

[
{ month: "02", year: "20" },
{
isValid: false,
isPotentiallyValid: true,
month: null,
year: null,
},
],
[
{ month: "0", year: "199" },

@@ -1226,0 +1253,0 @@ {

@@ -77,2 +77,6 @@ import { expirationYear, ExpirationYearVerification } from "../expiration-year";

],
[
"20",
{ isValid: false, isPotentiallyValid: true, isCurrentYear: false },
],
],

@@ -79,0 +83,0 @@ ],

@@ -62,2 +62,6 @@ import type { Verification } from "./types";

if (len === 2) {
if (String(currentYear).substr(0, 2) === value) {
return verification(false, true);
}
isCurrentYear = twoDigitYear === numericValue;

@@ -64,0 +68,0 @@ valid =

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc