module-name-from-path
v1.0.4
Published
Extract the Node.js module name given an abosulte path to a file inside the module
Downloads
4
Maintainers
Readme
module-name-from-path
Extract the Node.js module name given an absolute path to a file inside the module.
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