parent-module alternatives and similar modules
Based on the "Miscellaneous" category.
Alternatively, view parent-module alternatives based on common mentions on social networks and blogs.
-
mem
Memoize functions - an optimization technique used to speed up consecutive function calls by caching the result of calls with identical input -
basic-ftp
FTP client for Node.js, supports FTPS over TLS, passive mode over IPv6, async/await, and Typescript. -
schemapack
Create a schema object to encode/decode your JSON in to a compact byte buffer with no overhead. -
nar
node.js application archive - create self-contained binary like executable applications that are ready to ship and run -
Faster than fast, smaller than micro ... nano-memoizer.
Faster than fast, smaller than micro ... a nano speed and size (780 Brotili bytes) memoize for single and multiple argument functions.
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of parent-module or a related project?
README
parent-module
Get the path of the parent module
Node.js exposes module.parent
, but it only gives you the first cached parent, which is not necessarily the actual parent.
Install
$ npm install parent-module
Usage
// bar.js
const parentModule = require('parent-module');
module.exports = () => {
console.log(parentModule());
//=> '/Users/sindresorhus/dev/unicorn/foo.js'
};
// foo.js
const bar = require('./bar');
bar();
API
parentModule(filePath?)
By default, it will return the path of the immediate parent.
filePath
Type: string
\
Default: __filename
File path of the module of which to get the parent path.
Useful if you want it to work [multiple module levels down](fixtures/filepath).
Tip
Combine it with read-pkg-up
to read the package.json of the parent module.
const path = require('path');
const readPkgUp = require('read-pkg-up');
const parentModule = require('parent-module');
console.log(readPkgUp.sync({cwd: path.dirname(parentModule())}).pkg);
//=> {name: 'chalk', version: '1.0.0', โฆ}
Get professional support for this package with a Tidelift subscription Tidelift helps make open source sustainable for maintainers while giving companiesassurances about security, maintenance, and licensing for their dependencies.