Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
33 lines
785 B
Plaintext
33 lines
785 B
Plaintext
# module-details-from-path
|
|
|
|
Resolve npm package details, like name and base path, given an absolute path to a file inside a package.
|
|
|
|
[](https://github.com/feross/standard)
|
|
|
|
## Installation
|
|
|
|
```
|
|
npm install module-details-from-path --save
|
|
```
|
|
|
|
## Usage
|
|
|
|
```js
|
|
const assert = require('assert')
|
|
const parse = require('module-details-from-path')
|
|
|
|
const path = '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube/bin/tube.js'
|
|
|
|
assert.deepStrictEqual(parse(path), {
|
|
name: 'picture-tube',
|
|
basedir: '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube',
|
|
path: 'bin/tube.js'
|
|
})
|
|
```
|
|
|
|
Returns `undefined` if module details cannot be found.
|
|
|
|
## License
|
|
|
|
MIT
|