Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "array/remove"

Index

Functions

Functions

remove

  • remove<T>(array: T[], item: T, multi?: boolean): T[]
  • Removes an item from the array

    Removes all item references if multi is set to true


    Example:

    import { remove } from "@thalesrc/js-utils/array";
    
    const array = ["a", "b", "c", "a", "b", "c"];
    
    remove(array, "b"); // ["a", "c", "a", "b", "c"]
    remove(array, "b", true); // ["a", "c", "a", "c"]

    Prototype Example:

    import "@thalesrc/js-utils/array/proto/remove";
    
    const array = ["a", "b", "c", "a", "b", "c"];
    
    array.remove("b"); // ["a", "c", "a", "b", "c"]
    array.remove("b", true); // ["a", "c", "a", "c"]

    Type parameters

    • T

    Parameters

    • array: T[]
    • item: T
    • Default value multi: boolean = false

    Returns T[]

    New array

Generated using TypeDoc