module-name-from-path

1.0.4 • Public • Published

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

Package Sidebar

Install

npm i module-name-from-path

Weekly Downloads

0

Version

1.0.4

License

MIT

Last publish

Collaborators

  • watson