UNPKG

1.93 kBTypeScriptView Raw
1export = StackUtils;
2
3declare class StackUtils {
4 static nodeInternals(): RegExp[];
5 constructor(options?: StackUtils.Options);
6 clean(stack: string | string[]): string;
7 capture(limit?: number, startStackFunction?: Function): StackUtils.CallSite[];
8 capture(startStackFunction: Function): StackUtils.CallSite[];
9 captureString(limit?: number, startStackFunction?: Function): string;
10 captureString(startStackFunction: Function): string;
11 at(startStackFunction?: Function): StackUtils.CallSiteLike;
12 parseLine(line: string): StackUtils.StackLineData | null;
13}
14
15declare namespace StackUtils {
16 interface Options {
17 internals?: RegExp[] | undefined;
18 ignoredPackages?: string[] | undefined;
19 cwd?: string | undefined;
20 wrapCallSite?(callSite: CallSite): CallSite;
21 }
22
23 interface CallSite {
24 getThis(): object | undefined;
25 getTypeName(): string;
26 getFunction(): Function | undefined;
27 getFunctionName(): string;
28 getMethodName(): string | null;
29 getFileName(): string | undefined;
30 getLineNumber(): number;
31 getColumnNumber(): number;
32 getEvalOrigin(): CallSite | string;
33 isToplevel(): boolean;
34 isEval(): boolean;
35 isNative(): boolean;
36 isConstructor(): boolean;
37 }
38
39 interface CallSiteLike extends StackData {
40 type?: string | undefined;
41 }
42
43 interface StackLineData extends StackData {
44 evalLine?: number | undefined;
45 evalColumn?: number | undefined;
46 evalFile?: string | undefined;
47 }
48
49 interface StackData {
50 line?: number | undefined;
51 column?: number | undefined;
52 file?: string | undefined;
53 constructor?: boolean | undefined;
54 evalOrigin?: string | undefined;
55 native?: boolean | undefined;
56 function?: string | undefined;
57 method?: string | undefined;
58 }
59}