UNPKG

cross-caller

Version:

Gets the caller function, file and line number in all browsers and server environments

22 lines (21 loc) 864 B
export interface CallSite { /** The caller's function name */ function: string; /** The caller's file uri */ file: string; /** The caller's line number */ line: string; /** The caller's position in the line (column number) */ position: string; } /** * Parses the call site at the specified depth from a stack trace. * @param stack The stack trace string, typically from an Error object. * @param callerDepth The depth of the caller function in the stack. Zero means the immediate caller. */ export declare function parseCallSite(stack: string, callerDepth: number): CallSite | null; /** * Gets the call site of the caller function. * @param callerDepth The depth of the caller function in the stack. Default is 0, which means the immediate caller. */ export declare function getCaller(callerDepth?: number): CallSite | null;