Skip to content

assertcheck v1.0.0


assertcheck / assert / notEmpty

Function: notEmpty()

ts
function notEmpty<T>(v, opts?): asserts v is NonNullable<T>;

Defined in: src/assert.ts:163

Asserts that a value is not empty. Uses _.isEmpty, which handles strings, arrays, objects, Map, and Set.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
vTThe value to check.
opts?OptsOptional message / context.

Returns

asserts v is NonNullable<T>

Example

ts
assert.notEmpty(users, "users list must not be empty")

Released under the Apache 2.0 License. Built by Vagabond Studio — senior-only for growing companies.