Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@xylabs/assert
Advanced tools
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
XY Labs generalized Javascript library
Common Javascript code that is used throughout XYO projects that use React.
Using npm:
npm i --save @xylabs/assert
Using yarn:
yarn add @xylabs/assert
The assertEx
function is a utility function for simple null/undefined checks for variables. It evaluates an expression for truthiness and throws an error if the expression is false.
Here are some examples of how to use assertEx
in different scenarios:
Basic usage:
import { assertEx } from '@xylabs/assert';
const value = getValue(); // This is a function that may return null or undefined
assertEx(value); // Throws an AssertExError with a default message if value is null or undefined
Using with a custom error message:
import { assertEx } from '@xylabs/assert';
const value = getValue(); // This function may return null or undefined
assertEx(value, () => 'Dynamic error message based on some conditions'); // Throws an AssertExError with a dynamic message if value is null or undefined
See the LICENSE file for license details
FAQs
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
The npm package @xylabs/assert receives a total of 4,243 weekly downloads. As such, @xylabs/assert popularity was classified as popular.
We found that @xylabs/assert demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.