1.0.4 • Published 9 years ago

module-name-from-path v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

module-name-from-path

Extract the Node.js module name given an absolute path to a file inside the module.

Build status js-standard-style

Installation

npm install module-name-from-path --save

Usage

var assert = require('assert')
var parse = require('module-name-from-path')

var path = '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube/bin/tube.js'

assert.strictEqual(parse(path), 'picture-tube')

Returns undefined if module name cannot be found.

License

MIT