effect-io-ai

Package: effect
Module: Array

Array.remove

Removes the element at the specified index, returning a new array. If the index is out of bounds, returns a copy of the original.

When to use

Use when you want a missing index to be a no-op and need a fresh array result instead of an optional failure.

Example (Removing an element)

import { Array } from "effect"

console.log(Array.remove([1, 2, 3, 4], 2)) // [1, 2, 4]
console.log(Array.remove([1, 2, 3, 4], 5)) // [1, 2, 3, 4]

See

Signature

declare const remove: { (i: number): <A>(self: Iterable<A>) => Array<A>; <A>(self: Iterable<A>, i: number): Array<A>; }

Source

Since v2.0.0