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.3.0 to 3.0.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

3.0.0
=====
- correctly identify Maestro cards beginning with `6`
- __Breaking change__: The format of the `card` object returned has changed. `pattern` has been replaced by `prefixPattern` and `exactPattern`.
2.3.0

@@ -2,0 +8,0 @@ =====

6

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

@@ -30,3 +30,3 @@ "main": "index.js",

"gulp-watch": "^0.6.8",
"mocha": "^2.2.1",
"mocha": "^3.0.0",
"sinon": "^1.14.1",

@@ -37,5 +37,5 @@ "sinon-chai": "^2.7.0",

"dependencies": {
"credit-card-type": "^4.0.0",
"credit-card-type": "^5.0.0",
"lodash": "3.10.1"
}
}

@@ -255,24 +255,54 @@ # 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)

#### `valid.expirationMonth(value: string): boolean`
#### `valid.expirationMonth(value: string): object`
`expirationMonth` accepts 1 or 2 digit months. `1`, `01`, `10` are all valid entries.
```javascript
{
isValidForThisYear: false,
isPotentiallyValid: true,
isValid: true
}
```
- - -
#### `valid.expirationYear(value: string): boolean`
#### `valid.expirationYear(value: string): object`
`expirationYear` accepts 2 or 4 digit years. `16` and `2016` are both valid entries.
```javascript
{
isCurrentYear: false,
isPotentiallyValid: true,
isValid: true
}
```
- - -
#### `valid.cvv(value: string, maxLength: integer): boolean`
#### `valid.cvv(value: string, maxLength: integer): object`
The `cvv` validation by default tests for a numeric string of 3 characters in length. The `maxLength` can be overridden by passing in an `integer` as a second argument. You would typically switch this length from 3 to 4 in the case of an American Express card which expects a 4 digit CID.
```javascript
{
isPotentiallyValid: true,
isValid: true
}
```
- - -
#### `valid.postalCode(value: string): boolean`
#### `valid.postalCode(value: string): object`
The `postalCode` validation essentially tests for a valid string greater than 3 characters in length.
```javascript
{
isPotentiallyValid: true,
isValid: true
}
```
## Design decisions

@@ -282,2 +312,3 @@

- `valid.expirationDate` will only return `month:` and `year:` as strings if the two are valid, otherwise they will be `null`.
- Since non-US postal codes are alpha-numeric, the `postalCode` will allow non-number characters to be used in validation.

@@ -284,0 +315,0 @@ ## Development

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