Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xylabs/assert

Package Overview
Dependencies
Maintainers
7
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/assert - npm Package Compare versions

Comparing version 3.0.15 to 3.0.16

2

package.json

@@ -53,4 +53,4 @@ {

"sideEffects": false,
"version": "3.0.15",
"version": "3.0.16",
"type": "module"
}

@@ -39,7 +39,26 @@ [![logo][]](https://xylabs.com)

## Documentation
[Developer Reference](https://xylabs.github.io/sdk-js)
## Usage
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:
```javascript
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:
```javascript
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
## Maintainers
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))

@@ -46,0 +65,0 @@ - [Joel Carter](https://github.com/JoelBCarter)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc