effect-io-ai

Package: effect
Module: Array

Array.setNonEmptyLast

Change the last element, creating a new NonEmptyReadonlyArray.

Example

import { Array } from "effect"

const result = Array.setNonEmptyLast([1, 2, 3], 4)
console.log(result) // [1, 2, 4]

Signature

declare const setNonEmptyLast: { <B>(b: B): <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<A | B>; <A, B>(self: NonEmptyReadonlyArray<A>, b: B): NonEmptyArray<A | B>; }

Source

Since v2.0.0