Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0bc51f

Browse files
committed
fix: added null condition check (closes #13)
1 parent 2df8c8a commit f0bc51f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ export default (env, options) => {
1313

1414
Object.keys(env).forEach(key => {
1515
debug(`key "${key}" before type was ${typeof env[key]}`);
16-
env[key] = parseKey(env[key], key);
17-
debug(`key "${key}" after type was ${typeof env[key]}`);
18-
19-
if (envOptions.assignToProcessEnv === true) {
20-
if (envOptions.overrideProcessEnv === true) {
21-
process.env[key] = env[key] || process.env[key];
22-
} else {
23-
process.env[key] = process.env[key] || env[key];
16+
if (env[key]) {
17+
env[key] = parseKey(env[key], key);
18+
debug(`key "${key}" after type was ${typeof env[key]}`);
19+
if (envOptions.assignToProcessEnv === true) {
20+
if (envOptions.overrideProcessEnv === true) {
21+
process.env[key] = env[key] || process.env[key];
22+
} else {
23+
process.env[key] = process.env[key] || env[key];
24+
}
2425
}
2526
}
2627
});

0 commit comments

Comments
 (0)