capture-stack-trace
- Version 2.1.0
- Published
- 3.53 kB
- No dependencies
- MIT license
Install
npm i capture-stack-trace
yarn add capture-stack-trace
pnpm add capture-stack-trace
Overview
Error.captureStackTrace ponyfill
Index
Functions
Functions
function captureStackTrace
captureStackTrace: (targetObject: object) => void;
Creates a
.stack
property on the givenobject
, which when accessed returns a string representing the location in the code at whichcaptureStackTrace()
was called.Example 1
import captureStackTrace from 'capture-stack-trace';const object = {};captureStackTrace(object);object.stack; // Similar to `new Error().stack`
Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (2)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/capture-stack-trace
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/capture-stack-trace)
- HTML<a href="https://www.jsdocs.io/package/capture-stack-trace"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 900 ms. - Missing or incorrect documentation? Open an issue for this package.