XuelesszzZ 94af2b8e7b 6-30-5 | il y a 1 an | |
---|---|---|
.. | ||
node_modules | il y a 1 an | |
index.js | il y a 1 an | |
license | il y a 1 an | |
package.json | il y a 1 an | |
readme.md | il y a 1 an |
Get the callsite of the caller function
$ npm install --save caller-callsite
// foo.js
const callerCallsite = require('caller-callsite');
module.exports = () => {
console.log(callerCallsite().getFileName());
//=> '/Users/sindresorhus/dev/unicorn/bar.js'
}
// bar.js
const foo = require('./foo');
foo();
Returns a callsite
object.
MIT © Sindre Sorhus