![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
error-stringify
Advanced tools
Augment errors with `Error#toJSON` that preserves `name`, `message`, `stack` as well as any other normally stringified attribute.
Augment errors with Error#toJSON
that preserves name
, message
, stack
as well as any other
normally stringified attribute.
log.warn("error %j", error)
module.export
The usage vary between the following two extremes.
Pass what you need to control the behavior :)
require('error-stringify')()
Default behavior does not split stack traces, and includes only properties on the passed instance (enumerable or not).
options.target
parameter, or by the target
splitStackTrace
- booleanincludeProtoChain
- booleanvar AppError = require('./app-error-base');
require('error-stringify')({
target : AppError
splitStackTrace : true,
includeProtoChain : true
})
which is effectively the equivalent of:
var AppError = require('./app-error-base');
var options = {
splitStackTrace : true,
includeProtoChain : true
};
require('error-stringify')(options, AppError)
The later form is useful when you want to pick the options from a file and pass it as is, so you can pass the base Error constructor in the 2nd argument.
(see https://github.com/axios/axios/issues/6690)
require('error-stringify')({
allowOverrideToJSON : true
})
npm install error-stringify --save
MIT, and that's it
Happy coding :)
FAQs
Augment errors with `Error#toJSON` that preserves `name`, `message`, `stack` as well as any other normally stringified attribute.
The npm package error-stringify receives a total of 0 weekly downloads. As such, error-stringify popularity was classified as not popular.
We found that error-stringify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.