Skip to content

gulujs/caller-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@lunjs/caller-path

Get the path of the caller function

Installation

npm install @lunjs/caller-path

Usage

  • Example 1
// main.js
const { callerPath } = require('@lunjs/cller-path');
function main() {
  console.log(callerPath());
}
main(); // => /full/path/to/main.js
  • Example 2
// foo.js
const { callerPath } = require('@lunjs/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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published