UNPKG

find-node-modules

Version:

Return an array of all parent node_modules directories

14 lines (13 loc) 347 B
module.exports = function(moduleName) { try { return module.parent.require(moduleName); } catch (e) { // This could mean that we are in a browser context. // Add another try catch like it used to be, for backwards compability // and browserify reasons. try { return require(moduleName); } catch (e) {} } };