Hyperlinkv0.8.0-beta.28

Array

Array.initNonEmptyconsteffect/Array.ts:1268
<A>(self: NonEmptyReadonlyArray<A>): Array<A>

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]
Source effect/Array.ts:12681 lines
export const initNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => self.slice(0, -1)
Referenced by 4 symbols