|
|
3 years ago | |
|---|---|---|
| .. | ||
| .npmignore | 3 years ago | |
| .travis.yml | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| index.js | 3 years ago | |
| package.json | 3 years ago | |
| test.js | 3 years ago | |
Extract the Node.js module details like name and base path given an absolute path to a file inside the module.
npm install module-details-from-path --save
var assert = require('assert')
var parse = require('module-details-from-path')
var 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.
MIT