Function pullAllBy

  • This method is like pullAll except that it accepts iteratee which is invoked for each element of array and values to generate the criterion by which they're compared. The iteratee is invoked with one argument: (value).

    Note: Unlike differenceBy, this method mutates array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array to modify.

    • values: T[]

      The values to remove.

    • iteratee: KeyIteratee | ArrayIteratee<T>

      The iteratee invoked per element.

    Returns T[]

    Returns array.

    Since

    5.11.0

    See

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

    Example

    const array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }]

    pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x')
    console.log(array)
    // => [{ 'x': 2 }]