deep-resolve-from
Resolve the path of a module through a sequence of packages
Installation
npm i -S deep-resolve-from
Usage
'use strict'
const deepResolveFrom = require('deep-resolve-from')
console.log(deepResolveFrom(process.cwd(), ['mos', 'chalk', './package.json']))
//> /home/zkochan/src/deep-resolve-from/node_modules/.registry.npmjs.org/chalk/1.1.3/node_modules/chalk/package.json
API
deepResolveFrom(fromDir, moduleIds)
Like require()
, throws when the module can't be found.
deepResolveFrom.silent(fromDir, moduleIds)
Returns null
instead of throwing when the module can't be found.
fromDir
Type: string
Directory to resolve from.
moduleIds
Type: string[]
An array of module IDs, a module ID is something that you pass to require()
.
Related
- deep-resolve-cwd - Resolve the path of a module through a sequence of packages from the current working directory
- resolve-from - Resolve the path of a module like
require.resolve()
but from a given path
License
MIT © Zoltan Kochan