deep-resolve-from

Resolve the path of a module through a sequence of packages

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
deep-resolve-from
001.1.06 years ago6 years agoMinified + gzip package size for deep-resolve-from in KB

Readme

deep-resolve-from
Resolve the path of a module through a sequence of packages

npm version Build Status

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

  • resolve-from - Resolve the path of a module like require.resolve() but from a given path

License

MIT © Zoltan Kochan