Skip to content

Commit

Permalink
fix: removed wrapping of env[key]
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Feb 12, 2021
1 parent d6cd3a9 commit f0e9745
Show file tree
Hide file tree
Showing 4 changed files with 2,094 additions and 2,027 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ The defaults are listed below:
[MIT](LICENSE) © Nick Baugh


##
##

[lad]: https://lad.js.org

Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)"
],
"dependencies": {
"debug": "^4.1.1",
"debug": "^4.3.1",
"is-string-and-not-blank": "^0.0.2"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@commitlint/cli": "^9.1.2",
"@commitlint/config-conventional": "^9.1.2",
"ava": "^3.12.1",
"codecov": "^3.7.2",
"cross-env": "^7.0.2",
"@babel/cli": "^7.12.16",
"@babel/core": "^7.12.16",
"@babel/preset-env": "^7.12.16",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"ava": "^3.15.0",
"codecov": "^3.8.1",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"eslint": "^7.8.1",
"eslint-config-xo-lass": "^1.0.3",
"eslint": "^7.19.0",
"eslint-config-xo-lass": "^1.0.5",
"eslint-plugin-node": "^11.1.0",
"fixpack": "^3.0.6",
"husky": "^4.3.0",
"lint-staged": "^10.3.0",
"fixpack": "^4.0.0",
"husky": "^5.0.9",
"lint-staged": "^10.5.4",
"nyc": "^15.1.0",
"remark-cli": "^8.0.1",
"remark-preset-github": "^3.0.0",
"xo": "^0.33.1"
"remark-cli": "^9.0.0",
"remark-preset-github": "^4.0.1",
"xo": "^0.37.1"
},
"engines": {
"node": ">= 8.3.0"
Expand Down
30 changes: 14 additions & 16 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,20 @@ module.exports = (env, options) => {

for (const key of Object.keys(env)) {
debug(`key "${key}" before type was ${typeof env[key]}`);
if (env[key]) {
if (envOptions.ignoreFunctions && typeof env[key] === 'function') {
debug(
`key "${key}" was a function so it is being ignored due to ignoreFunctions: true`
);
continue;
}
if (envOptions.ignoreFunctions && typeof env[key] === 'function') {
debug(
`key "${key}" was a function so it is being ignored due to ignoreFunctions: true`
);
continue;
}

parsed[key] = parseKey(env[key], key);
debug(`key "${key}" after type was ${typeof parsed[key]}`);
if (envOptions.assignToProcessEnv === true) {
if (envOptions.overrideProcessEnv === true) {
process.env[key] = parsed[key] || process.env[key];
} else {
process.env[key] = process.env[key] || parsed[key];
}
parsed[key] = parseKey(env[key], key);
debug(`key "${key}" after type was ${typeof parsed[key]}`);
if (envOptions.assignToProcessEnv === true) {
if (envOptions.overrideProcessEnv === true) {
process.env[key] = parsed[key] || process.env[key];
} else {
process.env[key] = process.env[key] || parsed[key];
}
}
}
Expand Down Expand Up @@ -82,7 +80,7 @@ function parseKey(value, key) {
debug(`key ${key} parsed as an Array`);
return value
.split(',')
.filter(function (string) {
.filter((string) => {
return string !== '';
})
.map((string) => parseKey(string));
Expand Down
Loading

0 comments on commit f0e9745

Please sign in to comment.