effect-io-ai

Package: effect
Module: Array

Array.isArrayNonEmpty

Checks whether a mutable Array is non-empty, narrowing the type to NonEmptyArray.

When to use

Use when you need the narrowed value to remain a mutable Array after proving it has at least one element.

Example (Checking for a non-empty array)

import { Array } from "effect"

console.log(Array.isArrayNonEmpty([])) // false
console.log(Array.isArrayNonEmpty([1, 2, 3])) // true

See

Signature

declare const isArrayNonEmpty: <A>(self: Array<A>) => self is NonEmptyArray<A>

Source

Since v4.0.0