yrik 0fb20a58e3 提交 %!s(int64=4) %!d(string=hai) anos
..
index.js eec7f449c9 first commit %!s(int64=4) %!d(string=hai) anos
license eec7f449c9 first commit %!s(int64=4) %!d(string=hai) anos
package.json 0fb20a58e3 提交 %!s(int64=4) %!d(string=hai) anos
readme.md eec7f449c9 first commit %!s(int64=4) %!d(string=hai) anos

readme.md

caller-callsite Build Status

Get the callsite of the caller function

Install

$ npm install --save caller-callsite

Usage

// 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();

API

callerCallsite()

Returns a callsite object.

License

MIT © Sindre Sorhus