
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
boom-invariant
Advanced tools
An implementation of Facebook's invariant() function built on top of Boom errors
This is an implementation of Facebook's invariant()
function built on top of Boom, a library for constructing error
objects with HTTP status codes. Usage and behavior are similar to the original, but with two noteworthy changes:
400 Bad Request
.If you're using npm
:
npm i --save boom-invariant
If you're using yarn
:
yarn add boom-invariant`
// Throws a Boom error with a 400 `statusCode` when `someCondition` is not truthy.
invariant(someCondition, 'Uh oh! Condition was not met!');
// Throws a Boom error with a 418 `statusCode` when `someCondition` is not truthy.
invariant(someCondition, 'Uh oh! Condition was not met because I\'m a teapot!', 418);
Or if you don't enjoy recalling HTTP status codes:
// Throws a Boom error with a 400 `statusCode` when someCondition is not truthy.
invariant(someCondition, 'Uh oh! I can\'t find the resource!', Boom.notFound);
Note that the error message argument is required.
FAQs
An implementation of Facebook's invariant() function built on top of Boom errors
We found that boom-invariant demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.