package
Error.captureStackTrace ponyfill
npm install capture-stack-traceGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
3.4 kB
Includes dependencies.
This is useful for creating cross-platform code as Error#captureStackTrace is only available in V8-based JavaScript environments like Node.js and Chrome.
npm install capture-stack-traceimport captureStackTrace from 'capture-stack-trace';
const object = {};
captureStackTrace(object);
object.stack; // Similar to `new Error().stack`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.