deno.land / std@0.167.0 / node / internal / hide_stack_frames.ts

hide_stack_frames.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore no-explicit-anytype GenericFunction = (...args: any[]) => any;
/** This function removes unnecessary frames from Node.js core errors. */export function hideStackFrames<T extends GenericFunction = GenericFunction>( fn: T,): T { // We rename the functions that will be hidden to cut off the stacktrace // at the outermost one. const hidden = "__node_internal_" + fn.name; Object.defineProperty(fn, "name", { value: hidden });
return fn;}
std

Version Info

Tagged at
a year ago