Skip to content
Get the path of the caller module
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore init Apr 19, 2014
.travis.yml
fixture.js
fixture2.js
fixture3.js
index.js
license
package.json
readme.md
test.js

readme.md

caller-path Build Status

Get the path of the caller function

You have to use 'use strict'; in your code for this module to work correctly.

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

You can’t perform that action at this time.