Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zkochan/deep-resolve-from
Resolve the path of a module through a sequence of packages
https://github.com/zkochan/deep-resolve-from
Last synced: 29 days ago
JSON representation
Resolve the path of a module through a sequence of packages
- Host: GitHub
- URL: https://github.com/zkochan/deep-resolve-from
- Owner: zkochan
- License: mit
- Created: 2017-05-08T06:17:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-08T19:32:04.000Z (over 7 years ago)
- Last Synced: 2024-11-25T06:37:56.556Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deep-resolve-from
> Resolve the path of a module through a sequence of packages
[![npm version](https://img.shields.io/npm/v/deep-resolve-from.svg)](https://www.npmjs.com/package/deep-resolve-from) [![Build Status](https://img.shields.io/travis/zkochan/deep-resolve-from/master.svg)](https://travis-ci.org/zkochan/deep-resolve-from)
## Installation
```sh
npm i -S deep-resolve-from
```## Usage
```js
'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](https://github.com/zkochan/deep-resolve-cwd) - Resolve the path of a module through a sequence of packages from the current working directory
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path## License
[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io)