@lavadrop/ensure
v1.0.0
Published
Ensures value is defined (i.e., neither undefined nor null).
Downloads
14,557
Maintainers
Readme
@lavadrop/ensure
Part of a library of zero-dependency npm modules that do just one thing.
- 100% TypeScript support.
- It's not a party without
Lavadrop
!
min + gzip | 139 bytes
Ensures value
is defined (i.e., neither undefined
nor null
).
Usage
import ensure from '@lavadrop/ensure'
ensure(42)
// => 42
Parameters
| Name | Type | Description |
| :-------- | :------- | :---------- |
| value
| T
| |
| message
| string
| |
Type parameters
| Name |
| :--- |
| T
|
Returns
The original value
.
Return type
NonNullable<T>