@lavadrop/ensure
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@lavadrop/ensure

npm license Travis Build Status codecov Try @lavadrop/ensure on RunKit

Part of a library of zero-dependency npm modules that do just one thing.

npm

min + gzip | 139 bytes

source

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>

Package Sidebar

Install

npm i @lavadrop/ensure

Weekly Downloads

3,952

Version

1.0.0

License

MIT

Unpacked Size

7.45 kB

Total Files

8

Last publish

Collaborators

  • jedmao