npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

module-name-from-path

1.0.4

@watson

npmHomeRepoSnykSocket
Downloads:472
$ npm install module-name-from-path
DailyWeeklyMonthlyYearly

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