1. module-details-from-path
Extract the Node.js module details like name and base path given an abosulte path to a file inside the module
module-details-from-path
Package: module-details-from-path
Created by: watson
Last modified: Sat, 04 Mar 2023 05:05:18 GMT
Version: 1.0.3
License: MIT
Downloads: 25,502,577
Repository: https://github.com/watson/module-details-from-path

Install

npm install module-details-from-path
yarn add module-details-from-path

module-details-from-path

Extract the Node.js module details like name and base path given an
absolute path to a file inside the module.

Build status
js-standard-style

Installation

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

Usage

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

var 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

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin