Package: effect
Module: Array
Splits a non-empty array into its first element and the remaining elements.
When to use
Use when you have a NonEmptyReadonlyArray and need both its first element
and the remaining elements as separate values.
Details
Returns a tuple [head, tail] and requires a NonEmptyReadonlyArray.
Example (Destructuring head and tail)
import { Array } from "effect"
const result = Array.unprepend([1, 2, 3, 4])
console.log(result) // [1, [2, 3, 4]]
See
unappend for splitting a non-empty array into init and lastheadNonEmpty for getting only the first elementtailNonEmpty for getting only the elements after the firstSignature
declare const unprepend: <A>(self: NonEmptyReadonlyArray<A>) => [firstElement: A, remainingElements: Array<A>]
Since v2.0.0