stack-utils
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
escape-string-regexp | 2.0.0 | 1.66 kB | MIT | prod |
Stack-utils is an invaluable helper utility for JavaScript developers that provides capabilities to capture and clean stack traces. Designed to extract crucial information from the node-tap project, stack-utils offers control over what aspects of internal stack trace lines are included or culled, making error handling and debugging smoother and more manageable.
In terms of integrating stack-utils in your project, you can easily install it via the npm package manager using the command npm install --save stack-utils
. Once installed, it's straightforward to start using stack-utils in your JavaScript code:
const StackUtils = require('stack-utils');
const stack = new StackUtils({cwd: process.cwd(), internals: StackUtils.nodeInternals()});
console.log(stack.clean(new Error().stack));
// outputs a beautified stack trace
In the example above, we import stack-utils, create a new instance of StackUtils with the current working directory (cwd
) and the internal node modules (internals
) passed as options. We then capture a new Error's stack trace and clean it up using stack.clean method, logging the cleaned up stack trace to the console.
The document you pasted doesn't mention specific documentation outside of the readme file. However, the most comprehensive source of information for stack-utils is likely its GitHub repository, located at https://github.com/tapjs/stack-utils. This page contains details about the API, usage examples and the project's license. For in-depth understanding and latest updates about stack-utils, this repository should be your go-to reference point. As with any open-source tool, the codebase itself can be another valuable source of information.