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
Parameter | Type | Default value | Description |
---|---|---|---|
upStackBy | number | 1 | Optional. The number of functions to rewind in the calling stack. Default is 1. |
verbose | boolean | false | Optional. Shows all of the stack frames. Default is false. |
Returns
Name | Type | Description | Defined in |
---|---|---|---|
filePath | string | The full file path to the file that contains the calling function. | functions/stack.ts:27 |
functionName | string | The name of the calling function. | functions/stack.ts:24 |
Throws
If the calling function cannot be determined.