@availity/env-var
Advanced tools
Comparing version 1.6.0 to 1.6.2
46
index.js
@@ -27,26 +27,24 @@ let environments = { | ||
return ( | ||
Object.keys(environments).reduce((prev, env) => { | ||
if (prev) return prev; | ||
let envTests = environments[env]; | ||
if (!Array.isArray(envTests)) { | ||
envTests = [envTests]; | ||
} | ||
return Object.keys(environments).reduce((prev, env) => { | ||
if (prev) return prev; | ||
let envTests = environments[env]; | ||
if (!Array.isArray(envTests)) { | ||
envTests = [envTests]; | ||
} | ||
return ( | ||
envTests.some(test => { | ||
switch (Object.prototype.toString.call(test)) { | ||
case '[object String]': | ||
return test === subdomain; | ||
case '[object RegExp]': | ||
return test.test(subdomain); | ||
case '[object Function]': | ||
return test(); | ||
default: | ||
return false; | ||
} | ||
}) && env | ||
); | ||
}, '') || 'local' | ||
); | ||
return ( | ||
envTests.some(test => { | ||
switch (Object.prototype.toString.call(test)) { | ||
case '[object String]': | ||
return test === subdomain; | ||
case '[object RegExp]': | ||
return test.test(subdomain); | ||
case '[object Function]': | ||
return test(); | ||
default: | ||
return false; | ||
} | ||
}) && env | ||
); | ||
}, ''); | ||
} | ||
@@ -56,3 +54,3 @@ | ||
const env = getCurrentEnv(windowOverride); | ||
return varObj[env]; | ||
return typeof varObj[env] === 'undefined' ? varObj.local : varObj[env]; | ||
} |
{ | ||
"name": "@availity/env-var", | ||
"version": "1.6.0", | ||
"version": "1.6.2", | ||
"description": "Availity-specific way to determine variables based on the current environment the code is running in", | ||
@@ -5,0 +5,0 @@ "main": "src/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
10300
241