config 3.3.11 → 3.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config.js +3 -4
- package/package.json +1 -1
- package/parser.js +5 -2
package/lib/config.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
const DeferredConfig = require('../defer').DeferredConfig;
|
|
8
8
|
const RawConfig = require('../raw').RawConfig;
|
|
9
9
|
let Parser = require('../parser');
|
|
10
|
-
const Utils = require('util');
|
|
11
10
|
const Path = require('path');
|
|
12
11
|
const FileSystem = require('fs');
|
|
13
12
|
|
|
@@ -1003,12 +1002,12 @@ util.cloneDeep = function cloneDeep(parent, depth, circular, prototype) {
|
|
|
1003
1002
|
return parent;
|
|
1004
1003
|
}
|
|
1005
1004
|
|
|
1006
|
-
if (
|
|
1005
|
+
if (Array.isArray(parent)) {
|
|
1007
1006
|
child = [];
|
|
1008
|
-
} else if (
|
|
1007
|
+
} else if (parent instanceof RegExp) {
|
|
1009
1008
|
child = new RegExp(parent.source, util.getRegExpFlags(parent));
|
|
1010
1009
|
if (parent.lastIndex) child.lastIndex = parent.lastIndex;
|
|
1011
|
-
} else if (
|
|
1010
|
+
} else if (parent instanceof Date) {
|
|
1012
1011
|
child = new Date(parent.getTime());
|
|
1013
1012
|
} else if (useBuffer && Buffer.isBuffer(parent)) {
|
|
1014
1013
|
child = Buffer.alloc(parent.length);
|
package/package.json
CHANGED
package/parser.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// External libraries are lazy-loaded only if these file types exist.
|
|
2
|
-
const util = require("util");
|
|
3
2
|
|
|
4
3
|
// webpack can't solve dynamic module
|
|
5
4
|
// @see https://github.com/node-config/node-config/issues/755
|
|
@@ -61,7 +60,7 @@ Parser.xmlParser = function(filename, content) {
|
|
|
61
60
|
Parser.jsParser = function(filename, content) {
|
|
62
61
|
var configObject = require(filename);
|
|
63
62
|
|
|
64
|
-
if (configObject.__esModule &&
|
|
63
|
+
if (configObject.__esModule && isObject(configObject.default)) {
|
|
65
64
|
return configObject.default
|
|
66
65
|
}
|
|
67
66
|
return configObject;
|
|
@@ -366,3 +365,7 @@ Parser.setFilesOrder = function(name, newIndex) {
|
|
|
366
365
|
}
|
|
367
366
|
return order;
|
|
368
367
|
};
|
|
368
|
+
|
|
369
|
+
function isObject(arg) {
|
|
370
|
+
return (arg !== null) && (typeof arg === 'object');
|
|
371
|
+
}
|