Package: effect
Module: Array
Splits a non-empty array into two parts at the given index. The first part
is guaranteed to be non-empty (n is clamped to >= 1).
When to use
Use when downstream code requires the left side of the split to contain at least one element.
Example (Splitting a non-empty array)
import { Array } from "effect"
console.log(Array.splitAtNonEmpty(["a", "b", "c", "d", "e"], 3))
// [["a", "b", "c"], ["d", "e"]]
See
splitAt — for possibly-empty arraysSignature
declare const splitAtNonEmpty: { (n: number): <A>(self: NonEmptyReadonlyArray<A>) => [beforeIndex: NonEmptyArray<A>, fromIndex: Array<A>]; <A>(self: NonEmptyReadonlyArray<A>, n: number): [beforeIndex: NonEmptyArray<A>, fromIndex: Array<A>]; }
Since v4.0.0