Socket
Socket
Sign inDemoInstall

capture-stack-trace

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    capture-stack-trace

Error.captureStackTrace ponyfill


Version published
Weekly downloads
2M
increased by5.31%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

capture-stack-trace

Ponyfill for Error#captureStackTrace

This is useful for creating cross-platform code as Error#captureStackTrace is only available in V8-based JavaScript environments like Node.js and Chrome.

Install

npm install capture-stack-trace

Usage

import captureStackTrace from 'capture-stack-trace';

const object = {};
captureStackTrace(object);
object.stack;  // Similar to `new Error().stack`

API

captureStackTrace(object)

Creates a .stack property on the given object, which when accessed returns a string representing the location in the code at which captureStackTrace() was called.

Note: This ponyfill does not support the second parameter of Error#captureStackTrace.

Keywords

FAQs

Last updated on 10 Oct 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc