• Remove something from an Array

    Type Parameters

    • Arr extends any[]
    • Mode extends "index" | "value"

    Parameters

    • input: Arr
    • mode: Mode
    • value: Mode extends "index"
          ? number
          : Arr[number] | ((val) => boolean)

    Returns Arr

    Example

    import { array } from "@rjweb/utils"

    const arr = [1, 2, 3, 4, 5]

    array.remove(arr, 'index', 1) // [1, 3, 4, 5]
    array.remove(arr, 'value', 1) // [2, 3, 4, 5]

    Since

    1.0.0

    Supports

    nodejs, browser