Package: effect
Module: Array
Returns all elements except the first safely, wrapped in an Option.
When to use
Use to safely get all elements after the first when the iterable may be empty.
Details
Allocates a new array via slice(1). Empty inputs return Option.none().
Example (Getting the tail)
import { Array } from "effect"
console.log(Array.tail([1, 2, 3, 4])) // Option.some([2, 3, 4])
console.log(Array.tail([])) // Option.none()
See
tailNonEmpty — when the array is known non-emptyinit — all elements except the lastSignature
declare const tail: <A>(self: Iterable<A>) => Option.Option<Array<A>>
Since v2.0.0