Comparing version 0.5.4 to 1.0.0
@@ -15,5 +15,9 @@ var defaults = ['test', 'devel', 'stage', 'production']; | ||
var value = '' + this.value; | ||
if(this(val)) { | ||
process.env.NODE_ENV = val; | ||
this.current = val; | ||
// considered defined the first time the setter | ||
// is called explicitly | ||
this.defined = true; | ||
return function revert() { | ||
@@ -36,3 +40,3 @@ process.env.NODE_ENV = value; | ||
*/ | ||
function nenv(available, get, set, dbg) { | ||
function nenv(options = {}) { | ||
@@ -43,2 +47,7 @@ if(nenv.cache && !arguments.length) { | ||
let available = options.available | ||
let get = options.get | ||
let set = options.set | ||
let dbg = options.dbg | ||
if(typeof available === 'function') { | ||
@@ -183,2 +192,16 @@ get = available; | ||
if (options.strict === true) { | ||
if (!query.defined) { | ||
throw new TypeError('Expected NODE_ENV to be defined') | ||
} | ||
if (!query.valid) { | ||
throw new TypeError( | ||
'Unknown value for NODE_ENV "' + | ||
query.value + | ||
'", should be one of: ' + | ||
query.keys.join(', ')) | ||
} | ||
} | ||
return query; | ||
@@ -185,0 +208,0 @@ } |
{ | ||
"name": "nenv", | ||
"description": "Node development environment manager", | ||
"version": "0.5.4", | ||
"version": "1.0.0", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -6,0 +6,0 @@ "main": "lib/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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
15221
177
1
8
1