effect-io-ai

Package: effect
Module: Array

Array.initNonEmpty

Returns all elements except the last of a NonEmptyReadonlyArray.

When to use

Use to get all elements before the last when the array is known to be non-empty.

Example (Getting init of a non-empty array)

import { Array } from "effect"

console.log(Array.initNonEmpty([1, 2, 3, 4])) // [1, 2, 3]

See

Signature

declare const initNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => Array<A>

Source

Since v2.0.0