Comparing version 1.0.7 to 1.0.8
// info about each config option. | ||
var debug = process.env.DEBUG_NOPT | ||
var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG | ||
? function () { console.error.apply(console, arguments) } | ||
@@ -260,2 +260,3 @@ : function () {} | ||
val = JSON.parse(la) | ||
la = null | ||
if (no) val = !val | ||
@@ -265,2 +266,25 @@ i ++ | ||
// also support "foo":[Boolean, "bar"] and "--foo bar" | ||
if (Array.isArray(types[arg]) && la) { | ||
if (~types[arg].indexOf(la)) { | ||
// an explicit type | ||
val = la | ||
i ++ | ||
} else if ( la === "null" && ~types[arg].indexOf(null) ) { | ||
// null allowed | ||
val = null | ||
i ++ | ||
} else if ( !la.match(/^-{2,}[^-]/) && | ||
!isNaN(la) && | ||
~types[arg].indexOf(Number) ) { | ||
// number | ||
val = +la | ||
i ++ | ||
} else if ( !la.match(/^-[^-]/) && ~types[arg].indexOf(String) ) { | ||
// string | ||
val = la | ||
i ++ | ||
} | ||
} | ||
if (isArray) (data[arg] = data[arg] || []).push(val) | ||
@@ -325,3 +349,3 @@ else data[arg] = val | ||
var assert = require("assert") | ||
, sys = require("sys") | ||
, util = require("util") | ||
@@ -471,2 +495,5 @@ , shorthands = | ||
,[]] | ||
,["--color always" | ||
,{color:"always"} | ||
,[]] | ||
].forEach(function (test) { | ||
@@ -479,3 +506,3 @@ var argv = test[0].split(/\s+/) | ||
delete actual.argv | ||
console.log(sys.inspect(actual, false, 2, true), parsed.remain) | ||
console.log(util.inspect(actual, false, 2, true), parsed.remain) | ||
for (var i in opts) { | ||
@@ -482,0 +509,0 @@ var e = JSON.stringify(opts[i]) |
{ "name" : "nopt" | ||
, "version" : "1.0.7" | ||
, "version" : "1.0.8" | ||
, "description" : "Option parsing for Node, supporting types, shorthands, etc. Used by npm." | ||
@@ -4,0 +4,0 @@ , "author" : "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)" |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
25474
535
3