All Projects → watson → Module Details From Path

watson / Module Details From Path

Licence: mit
Extract the Node.js module details like name and base path given an abosulte path to a file inside the module

Programming Languages

javascript
184084 projects - #8 most used programming language

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].