We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ad8131 commit a86a0caCopy full SHA for a86a0ca
src/cli/utils/load.js
@@ -16,7 +16,13 @@ module.exports = function (source, cb) {
16
17
var filename = path.resolve(source)
18
delete require.cache[filename]
19
- data = require(filename)()
+ var dataFn = require(filename)
20
+
21
+ if (typeof dataFn !== 'function') {
22
+ throw new Error('The database is a JavaScript file but the export is not a function.')
23
+ }
24
25
+ data = dataFn()
26
cb(null, data)
27
28
} else if (is.JSON(source)) {
0 commit comments