Skip to content

watson/module-details-from-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

module-details-from-path

Resolve npm package details, like name and base path, given an absolute path to a file inside a package.

js-standard-style

Installation

npm install module-details-from-path --save

Usage

const assert = require('assert')
const parse = require('module-details-from-path')

const 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

About

Resolve npm package details, like name and base path, given an absolute path to a file inside a package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •