Hyperlinkv0.8.0-beta.28

Array

Array.isArrayNonEmptyconsteffect/Array.ts:866
<A>(self: Array<A>): self is NonEmptyArray<A>

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
Source effect/Array.ts:8661 lines
export const isArrayNonEmpty: <A>(self: Array<A>) => self is NonEmptyArray<A> = internalArray.isArrayNonEmpty
Referenced by 12 symbols