Stack Patcher
4KB package wraps any function in function with your custom name to help you catch bugs in error stacktraces
Example • Source File • Repo • Why??? [RU]
- Small. Weighs only
4KB
; - Fast and Secure. Uses JS-native approach of renaming functions instead of eval;
- Simple. You can just copy source to your project, i wan't be mad.
- Cross-Platform. Works in node and browser
Example
import { wrapCall } from "stack-patcher";
const call = wrapCall("username=AlexXanderGrib", () => {
throw new Error();
});
call.async()
.catch((error) => console.log(error.stack));
Installation
- Using
npm
npm i stack-patcher
- Using
Yarn
yarn add stack-patcher
- Using
pnpm
pnpm add stack-patcher
Import
-
CommonJS (default for Node JS)
const { wrapCall } = require("stack-patcher");
-
TypeScript or ES Modules
import { wrapCall } from "stack-patcher";