Comparing version 0.9.0 to 0.9.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const formatToPattern = new Map([ | ||
['yyyy-mm-dd', { | ||
regex: /^[0-9]{4}-[01][0-9]-[0-3][0-9]$/, | ||
replacement: '', | ||
}], | ||
['mm/dd/yyyy', { | ||
@@ -30,5 +34,2 @@ regex: /^([01][0-9])\/([0-3][0-9])\/([0-9]{4})$/, | ||
exports.default = (value, dateFormat, isoDatetime = false) => { | ||
if (typeof value !== 'string') { | ||
return undefined; | ||
} | ||
const emptyPattern = { regex: / /, replacement: '' }; | ||
@@ -57,2 +58,7 @@ let pattern; | ||
} | ||
// Don't change formatting if it is already formatted as ISO8601 | ||
pattern = formatToPattern.get('yyyy-mm-dd') || emptyPattern; | ||
if (pattern.regex.test(value)) { | ||
return value; | ||
} | ||
if (isoDatetime) { | ||
@@ -59,0 +65,0 @@ const isoRegex = new RegExp([ |
{ | ||
"name": "csvnorm", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Command line tool to normalize CSV and *SV files.", | ||
@@ -5,0 +5,0 @@ "main": "binary/source/index.js", |
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
35312
46
794
11