UNPKG

539 BMarkdownView Raw
1# caller-path [![Build Status](https://travis-ci.org/sindresorhus/caller-path.svg?branch=master)](https://travis-ci.org/sindresorhus/caller-path)
2
3> Get the path of the caller function
4
5
6## Install
7
8```
9$ npm install --save caller-path
10```
11
12
13## Usage
14
15```js
16// foo.js
17const callerPath = require('caller-path');
18
19module.exports = () => {
20 console.log(callerPath());
21 //=> '/Users/sindresorhus/dev/unicorn/bar.js'
22}
23```
24
25```js
26// bar.js
27const foo = require('./foo');
28foo();
29```
30
31
32## License
33
34MIT © [Sindre Sorhus](https://sindresorhus.com)