Skip to main content

Stack

Helper functions relating to rewinding the call stack.

Functions

getCallingFunction()

function getCallingFunction(upStackBy, verbose): object;

Defined in: functions/stack.ts:19

Helper function to get the name and file path of the calling function.

This function handles both Node.js and Bun. (Bun implements the v8 stack trace API differently.)

Parameters

ParameterTypeDefault valueDescription
upStackBynumber1Optional. The number of functions to rewind in the calling stack. Default is 1.
verbosebooleanfalseOptional. Shows all of the stack frames. Default is false.

Returns

NameTypeDescriptionDefined in
filePathstringThe full file path to the file that contains the calling function.functions/stack.ts:27
functionNamestringThe name of the calling function.functions/stack.ts:24

Throws

If the calling function cannot be determined.