aboutsummaryrefslogtreecommitdiff
path: root/node_modules/resolve-from/index.js
diff options
context:
space:
mode:
authorWaref Haque <warefhaque@Warefs-MacBook-Pro.local>2016-07-17 20:24:49 +0000
committerWaref Haque <warefhaque@Warefs-MacBook-Pro.local>2016-07-17 20:24:49 +0000
commite58943c3e620f05937656fdde032254ae3373f36 (patch)
tree77072aa55efa1753c8c8ae584669cf3589551268 /node_modules/resolve-from/index.js
parent55098c767afb0b119aaeda330eaedba5c1a87dc3 (diff)
redirect commit
Diffstat (limited to 'node_modules/resolve-from/index.js')
-rw-r--r--node_modules/resolve-from/index.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/node_modules/resolve-from/index.js b/node_modules/resolve-from/index.js
new file mode 100644
index 0000000..434159f
--- /dev/null
+++ b/node_modules/resolve-from/index.js
@@ -0,0 +1,23 @@
+'use strict';
+var path = require('path');
+var Module = require('module');
+
+module.exports = function (fromDir, moduleId) {
+ if (typeof fromDir !== 'string' || typeof moduleId !== 'string') {
+ throw new TypeError('Expected `fromDir` and `moduleId` to be a string');
+ }
+
+ fromDir = path.resolve(fromDir);
+
+ var fromFile = path.join(fromDir, 'noop.js');
+
+ try {
+ return Module._resolveFilename(moduleId, {
+ id: fromFile,
+ filename: fromFile,
+ paths: Module._nodeModulePaths(fromDir)
+ });
+ } catch (err) {
+ return null;
+ }
+};