Function pullAllWith

  • This method is like pullAll except that it accepts comparator which is invoked to compare elements of array to values. The comparator is invoked with two arguments: (arrVal, othVal).

    Note: Unlike differenceWith, this method mutates array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array to modify.

    • values: T[]

      The values to remove.

    • comparator: Comparator<T>

      The comparator invoked per element.

    Returns T[]

    Returns array.

    5.11.0

    [[pull]], [[pullAll]], [[pullAllBy]], [[pullAt]], [[remove]], [[reject]]

    const array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }]

    pullAllWith(array, [{ 'x': 3, 'y': 4 }], isEqual)
    console.log(array)
    // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]