We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 547afa2 commit f2ccb99Copy full SHA for f2ccb99
lib/inquire/index.js
@@ -8,12 +8,17 @@ module.exports = inquire;
8
* @returns {?Object} Required module if available and not empty, otherwise `null`
9
*/
10
function inquire(moduleName) {
11
- try {
12
- var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
13
- if (mod && (mod.length || Object.keys(mod).length))
14
- return mod;
15
- } catch (e) {} // eslint-disable-line no-empty
+ try {
+ if (typeof require !== "function") {
+ return null;
+ }
+ var mod = require(moduleName);
16
+ if (mod && (mod.length || Object.keys(mod).length)) return mod;
17
return null;
18
+ } catch (err) {
19
+ // ignore
20
21
22
}
23
24
/*
0 commit comments