Function pullFirst

  • Removes the first occurrence of an element from an array. If the element does not exist in the array, nothing is done.

    Note that the input array is being mutated.

    Since

    2.8.0

    See

    lodash.pullAt

    Returns

    The mutated array.

    Example

    const a = ["foo", "bar", "fizz", "bar"];
    removeItem(a, "bar")
    // => ["foo", "fizz", "bar"]

    const b = ["foo", "bar", "fizz", "bar"];
    removeItem(b, "bazz")
    // => ["foo", "bar", "fizz", "bar"]

    Type Parameters

    • TValue

    Parameters

    • array: TValue[]

      Array to modify.

    • value: TValue

      The value to remove.

    Returns TValue[]

Generated using TypeDoc