Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

array.ts

15 lines367 Bytes

1/**
2 * @since 2.0.0
3 */
4​
5import type { NonEmptyArray } from "../Array.ts"
6​
7/** @internal */
8export const isArrayNonEmpty = <A>(self: ReadonlyArray<A>): self is NonEmptyArray<A> => self.length > 0
9​
10/** @internal */
11export function replaceAt<A>(self: ReadonlyArray<A>, index: number, value: A): Array<A> {
12 const out = self.slice()
13 out[index] = value
14 return out