Comparing version 0.0.7 to 0.0.8
24
index.js
@@ -19,2 +19,4 @@ /* eslint-disable no-console */ | ||
const reTimeParam = /^(\d+)([dhms]$)/i; | ||
module.exports = { | ||
@@ -423,2 +425,24 @@ getRecognitionScore (unrecognizedString, recognizedString) { | ||
}, | ||
getTimeParamMillis: (val) => { | ||
const [, nn, dhms] = reTimeParam.exec(val || '') || []; | ||
if (!nn) { | ||
return; | ||
} | ||
let sec = 0; | ||
switch (dhms.toLowerCase()) { | ||
case 'd': | ||
sec = 24 * 3600 * nn; | ||
break; | ||
case 'h': | ||
sec = 3600 * nn; | ||
break; | ||
case 'm': | ||
sec = 60 * nn; | ||
break; | ||
default: | ||
sec = nn; | ||
} | ||
return sec * 1000; | ||
}, | ||
}; |
{ | ||
"name": "af-fns", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A highly specialized function library", | ||
@@ -5,0 +5,0 @@ "main": "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
13258
414