JSPM

module-details-from-path

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13058884
  • Score
    100M100P100Q219269F
  • License MIT

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

Package Exports

  • module-details-from-path
  • module-details-from-path/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (module-details-from-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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