@gulujs/caller-path
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

@gulujs/caller-path

Get the path of the caller function

Installation

npm install @gulujs/caller-path

Usage

  • Example 1
// main.js
const { callerPath } = require('@gulujs/cller-path');
function main() {
  console.log(callerPath());
}
main(); // => /full/path/to/main.js
  • Example 2
// foo.js
const { callerPath } = require('@gulujs/cller-path');
function foo() {
  console.log(callerPath({ shift: 1 }))
}
module.exports = {
  foo
};
// bar.js
const { foo } = require('./foo');
foo(); // => /full/path/to/bar.js

API

callerPath(options?)

  • shift
    • Type: number
    • Default: 0
  • excludeFileNames
    • Type: Array<string|RegExp>
    • Default: undefined
  • excludeFunctionNames
    • Type: Array<string|RegExp>
    • Default: undefined
  • debug
    • Type: boolean
    • Default: false

License

MIT

Package Sidebar

Install

npm i @gulujs/caller-path

Weekly Downloads

0

Version

0.3.0

License

MIT

Unpacked Size

4.43 kB

Total Files

5

Last publish

Collaborators

  • jkeylu