API/api.medcify.app/node_modules/module-details-from-path
2022-09-26 11:41:44 +05:30
..
.npmignore final 2022-09-26 11:41:44 +05:30
.travis.yml final 2022-09-26 11:41:44 +05:30
index.js final 2022-09-26 11:41:44 +05:30
LICENSE final 2022-09-26 11:41:44 +05:30
package.json final 2022-09-26 11:41:44 +05:30
README.md final 2022-09-26 11:41:44 +05:30
test.js final 2022-09-26 11:41:44 +05:30

module-details-from-path

Extract the Node.js module details like name and base path given an absolute path to a file inside the module.

Build status js-standard-style

Installation

npm install module-details-from-path --save

Usage

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.

License

MIT