Attempts to get the path to the file that contains the code that called the code that called this function. I know, it's confusing, but it's cool.
// /path/to/file.tsimport { foo } from './path/to/foo.ts';foo(); Copy
// /path/to/file.tsimport { foo } from './path/to/foo.ts';foo();
// /path/to/foo.tsimport { getCallerPath } from 'src/utils/get-caller';export function foo() { console.log(getCallerPath()); // /path/to/file.ts} Copy
// /path/to/foo.tsimport { getCallerPath } from 'src/utils/get-caller';export function foo() { console.log(getCallerPath()); // /path/to/file.ts}
Attempts to get the path to the file that contains the code that called the code that called this function. I know, it's confusing, but it's cool.