Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stack-patcher

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stack-patcher

Wraps calls in named function to have context in stacktrace

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Stack Patcher

4KB package wraps any function in function with your custom name to help you catch bugs in error stacktraces

ExampleSource FileRepoWhy??? [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));
// Error
//   at example.ts:4:4
//   at username=AlexXanderGrib
//      ^^^^^^^^^^^^^^^^^^^^^^^

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";
    

Keywords

FAQs

Package last updated on 19 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc