You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
539 B

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