Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "good-env",
"version": "7.6.2",
"version": "7.6.3",
"description": "Better environment variable handling for Twelve-Factor node apps",
"main": "src/index.js",
"scripts": {
Expand Down
13 changes: 4 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const isNumber = x => is(x) === '[object Number]';
const isBoolean = x => is(x) === '[object Boolean]';
const isObject = x => is(x) === '[object Object]';
const isFunction = x => is(x) === '[object Function]';
const parse = (items, converter) => items.map(t => converter(t, 10));
const mapNums = items => parse(items, parseInt);
const mapNums = items => items.map(t => parseFloat(t));
const validType = item => ['number', 'boolean', 'string'].includes(item);
const store = { ...process.env };

Expand Down Expand Up @@ -110,11 +109,7 @@ module.exports = Object
* @returns {object}
*/
getUrl (key, defaultVal) {
let urlStr = this.get(key, defaultVal);

if (urlStr === defaultVal) {
urlStr = defaultVal;
}
const urlStr = this.get(key, defaultVal);

try {
return makeGoodUrl({ url: new URL(urlStr) });
Expand Down Expand Up @@ -161,7 +156,7 @@ module.exports = Object
return false;
});

if (!ok(value) && typeof ok(defaultVal)) {
if (!ok(value) && ok(defaultVal)) {
value = defaultVal;
}

Expand All @@ -185,7 +180,7 @@ module.exports = Object
}, {})
);

const arrMapper = (keys, getter) => items.map(key => getter(key));
const arrMapper = (keys, getter) => keys.map(key => getter(key));

if (isArray(items)) {
return arrMapper(items, this.get);
Expand Down
Loading