Comparing version 0.5.1 to 0.5.2
18
index.js
@@ -313,6 +313,5 @@ var path = require('path'); | ||
function setArg (key, val) { | ||
var num = Number(val); | ||
var value = typeof val !== 'string' || isNaN(num) ? val : num; | ||
if (flags.strings[key]) value = val; | ||
var value = !flags.strings[key] && isNumber(val) | ||
? Number(val) : val | ||
; | ||
setKey(argv, key.split('.'), value); | ||
@@ -407,4 +406,5 @@ | ||
else { | ||
var n = Number(arg); | ||
argv._.push(flags.strings['_'] || isNaN(n) ? arg : n); | ||
argv._.push( | ||
flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) | ||
); | ||
} | ||
@@ -495,1 +495,7 @@ } | ||
} | ||
function isNumber (x) { | ||
if (typeof x === 'number') return true; | ||
if (/^0x[0-9a-f]+$/i.test(x)) return true; | ||
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); | ||
} |
{ | ||
"name" : "optimist", | ||
"version" : "0.5.1", | ||
"version" : "0.5.2", | ||
"description" : "Light-weight option parsing with an argv hash. No optstrings attached.", | ||
@@ -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
51464
29
1344