Skip to content

Commit f0e9745

Browse files
committed
fix: removed wrapping of env[key]
1 parent d6cd3a9 commit f0e9745

File tree

4 files changed

+2094
-2027
lines changed

4 files changed

+2094
-2027
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ The defaults are listed below:
145145
[MIT](LICENSE) © Nick Baugh
146146

147147

148-
##
148+
##
149149

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

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@
1919
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)"
2020
],
2121
"dependencies": {
22-
"debug": "^4.1.1",
22+
"debug": "^4.3.1",
2323
"is-string-and-not-blank": "^0.0.2"
2424
},
2525
"devDependencies": {
26-
"@babel/cli": "^7.11.6",
27-
"@babel/core": "^7.11.6",
28-
"@babel/preset-env": "^7.11.5",
29-
"@commitlint/cli": "^9.1.2",
30-
"@commitlint/config-conventional": "^9.1.2",
31-
"ava": "^3.12.1",
32-
"codecov": "^3.7.2",
33-
"cross-env": "^7.0.2",
26+
"@babel/cli": "^7.12.16",
27+
"@babel/core": "^7.12.16",
28+
"@babel/preset-env": "^7.12.16",
29+
"@commitlint/cli": "^11.0.0",
30+
"@commitlint/config-conventional": "^11.0.0",
31+
"ava": "^3.15.0",
32+
"codecov": "^3.8.1",
33+
"cross-env": "^7.0.3",
3434
"dotenv": "^8.2.0",
35-
"eslint": "^7.8.1",
36-
"eslint-config-xo-lass": "^1.0.3",
35+
"eslint": "^7.19.0",
36+
"eslint-config-xo-lass": "^1.0.5",
3737
"eslint-plugin-node": "^11.1.0",
38-
"fixpack": "^3.0.6",
39-
"husky": "^4.3.0",
40-
"lint-staged": "^10.3.0",
38+
"fixpack": "^4.0.0",
39+
"husky": "^5.0.9",
40+
"lint-staged": "^10.5.4",
4141
"nyc": "^15.1.0",
42-
"remark-cli": "^8.0.1",
43-
"remark-preset-github": "^3.0.0",
44-
"xo": "^0.33.1"
42+
"remark-cli": "^9.0.0",
43+
"remark-preset-github": "^4.0.1",
44+
"xo": "^0.37.1"
4545
},
4646
"engines": {
4747
"node": ">= 8.3.0"

src/index.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,20 @@ module.exports = (env, options) => {
1414

1515
for (const key of Object.keys(env)) {
1616
debug(`key "${key}" before type was ${typeof env[key]}`);
17-
if (env[key]) {
18-
if (envOptions.ignoreFunctions && typeof env[key] === 'function') {
19-
debug(
20-
`key "${key}" was a function so it is being ignored due to ignoreFunctions: true`
21-
);
22-
continue;
23-
}
17+
if (envOptions.ignoreFunctions && typeof env[key] === 'function') {
18+
debug(
19+
`key "${key}" was a function so it is being ignored due to ignoreFunctions: true`
20+
);
21+
continue;
22+
}
2423

25-
parsed[key] = parseKey(env[key], key);
26-
debug(`key "${key}" after type was ${typeof parsed[key]}`);
27-
if (envOptions.assignToProcessEnv === true) {
28-
if (envOptions.overrideProcessEnv === true) {
29-
process.env[key] = parsed[key] || process.env[key];
30-
} else {
31-
process.env[key] = process.env[key] || parsed[key];
32-
}
24+
parsed[key] = parseKey(env[key], key);
25+
debug(`key "${key}" after type was ${typeof parsed[key]}`);
26+
if (envOptions.assignToProcessEnv === true) {
27+
if (envOptions.overrideProcessEnv === true) {
28+
process.env[key] = parsed[key] || process.env[key];
29+
} else {
30+
process.env[key] = process.env[key] || parsed[key];
3331
}
3432
}
3533
}
@@ -82,7 +80,7 @@ function parseKey(value, key) {
8280
debug(`key ${key} parsed as an Array`);
8381
return value
8482
.split(',')
85-
.filter(function (string) {
83+
.filter((string) => {
8684
return string !== '';
8785
})
8886
.map((string) => parseKey(string));

0 commit comments

Comments
 (0)