Package: effect
Module: Array
Keeps the last n elements, creating a new array.
When to use
Use to keep the last n elements of an iterable.
Details
n is clamped to [0, length]. Returns an empty array when n <= 0.
Example (Taking from the end)
import { Array } from "effect"
console.log(Array.takeRight([1, 2, 3, 4, 5], 3)) // [3, 4, 5]
See
take — keep from the startdropRight — remove from the endSignature
declare const takeRight: { (n: number): <A>(self: Iterable<A>) => Array<A>; <A>(self: Iterable<A>, n: number): Array<A>; }
Since v2.0.0