Comparing version 0.2.0 to 0.3.0
@@ -15,2 +15,3 @@ "use strict"; | ||
exports.validateExpiryMonth = validateExpiryMonth; | ||
exports.formatNumber = formatNumber; | ||
@@ -26,3 +27,4 @@ var _lodashCollectionFind = require("lodash/collection/find"); | ||
validateExpiryYear: validateExpiryYear, | ||
validateExpiryMonth: validateExpiryMonth | ||
validateExpiryMonth: validateExpiryMonth, | ||
formatNumber: formatNumber | ||
}; | ||
@@ -53,2 +55,3 @@ | ||
pattern: /^5019/, | ||
length: [16], | ||
cvcLength: [3], | ||
@@ -181,3 +184,3 @@ luhn: true | ||
// Remove all extra characters from the string | ||
return ("" + text).replace(/[\. ,:-]+/g, ""); | ||
return ("" + text).replace(/\D/g, ""); | ||
} | ||
@@ -205,3 +208,3 @@ | ||
// Everything seems to check out return the card type | ||
return card.type; | ||
return card; | ||
} | ||
@@ -245,2 +248,14 @@ | ||
return true; | ||
} | ||
function formatNumber(value) { | ||
var text = cleanNumber(value); | ||
var card = match(text); | ||
// 16-digit cards can be easily formatted | ||
if (card != null && card.length.indexOf(16) >= 0 && text.length <= 16) { | ||
text = text.replace(/(\d{4})/g, "$1 ").trim(); | ||
} | ||
return text; | ||
} |
{ | ||
"name": "dosh", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -16,2 +16,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"babel-runtime": "^5.8.25", | ||
"lodash": "^3.10.1" | ||
@@ -18,0 +19,0 @@ }, |
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
11198
272
2
+ Addedbabel-runtime@^5.8.25
+ Addedbabel-runtime@5.8.38(transitive)
+ Addedcore-js@1.2.7(transitive)