creditable
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -5,9 +5,22 @@ // Input a credit card number string, returns a key signifying the type of credit card it is | ||
var types = { | ||
MASTERCARD: /^(2[2-7]|5[1-5])/, // 22-27 and 51-55 | ||
VISA: /^4/, | ||
DISCOVER: /^6(011|5)/, // 6011 or 65 | ||
AMEX: /^3[47]/ // 34 or 37 | ||
var keys = { | ||
MASTERCARD: "MASTERCARD", | ||
VISA: "VISA", | ||
DISCOVER: "DISCOVER", | ||
AMEX: "AMEX" | ||
}; | ||
var types = {}; | ||
// 2221-2720 and 51-55 | ||
types[ keys.MASTERCARD ] = /^(222[1-9]|22[3-9]|2[3-6]|27[01]|2720|5[1-5])/; | ||
types[ keys.VISA ] = /^4/; | ||
// 6011 or 65 | ||
types[ keys.DISCOVER ] = /^6(011|22(12[6-9]|1[3-9]|[2-8]|9[0-1]|92[0-5])|4[4-9]|5)/; | ||
// 34 or 37 | ||
types[ keys.AMEX ] = /^3[47]/; | ||
function CreditableCardType( val ) { | ||
@@ -23,2 +36,3 @@ for( var j in types ) { | ||
CreditableCardType.KEYS = keys; | ||
CreditableCardType.TYPES = types; | ||
@@ -25,0 +39,0 @@ w.CreditableCardType = CreditableCardType; |
{ | ||
"name": "creditable", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Utilities for working with credit card form input.", | ||
@@ -16,5 +16,13 @@ "main": "creditablecardtype.js", | ||
"homepage": "https://github.com/filamentgroup/creditable#readme", | ||
"scripts": { | ||
"test": "./node_modules/.bin/grunt test" | ||
}, | ||
"dependencies": { | ||
"shoestring": "^1.0.3" | ||
}, | ||
"devDependencies": { | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-qunit": "^1.2.0", | ||
"qunitjs": "^2.0.1" | ||
} | ||
} |
# creditable | ||
[![npm version](https://badge.fury.io/js/creditable.svg)](https://badge.fury.io/js/creditable) | ||
[![Build Status](https://img.shields.io/travis/filamentgroup/creditable/master.svg)](https://travis-ci.org/filamentgroup/creditable) | ||
[![Dependency Status](https://david-dm.org/filamentgroup/creditable.svg?theme=shields.io)](https://david-dm.org/filamentgroup/creditable) | ||
Utilities for working with credit card form input. | ||
@@ -14,3 +19,3 @@ | ||
CreditableCardType( "6011 1234 1234 1234" ); | ||
// returns "MASTERCARD"; | ||
// returns "DISCOVER"; | ||
@@ -17,0 +22,0 @@ CreditableCardType( "3412 123456 12345" ); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10452
11
128
41
3