lihai 8d6c751f49 feat: push | 2 gadi atpakaļ | |
---|---|---|
.. | ||
node_modules | 2 gadi atpakaļ | |
index.js | 2 gadi atpakaļ | |
license | 2 gadi atpakaļ | |
package.json | 2 gadi atpakaļ | |
readme.md | 2 gadi atpakaļ |
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