line_push/node_modules/caller-path
2022-07-18 02:50:52 +00:00
..
index.js add file 2022-07-17 13:16:16 +08:00
license add file 2022-07-17 13:16:16 +08:00
package.json update 2022-07-18 02:50:52 +00:00
readme.md add file 2022-07-17 13:16:16 +08:00

caller-path Build Status

Get the path of the caller function

Install

$ npm install --save caller-path

Usage

// foo.js
const callerPath = require('caller-path');

module.exports = () => {
	console.log(callerPath());
	//=> '/Users/sindresorhus/dev/unicorn/bar.js'
}
// bar.js
const foo = require('./foo');
foo();

License

MIT © Sindre Sorhus