get-caller-file
Installation
yarn add get-caller-fileUsage
// ./foo.js
const getCallerFile = require('get-caller-file');
module.exports = function() {
return getCallerFile(); // figures out who called it
};// index.js
const foo = require('./foo');
foo() // => /full/path/to/this/file/index.jsOptions:
Last updated