pullAllBy

array

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.

Signature

pullAllBy<T, U>(array: T[], values: T[], iteratee: (value: T) => U): T[]

Parameters

NameTypeDescription
arrayT[]The array to modify
valuesT[]The values to remove
iteratee(value: T) => UThe iteratee invoked per element

Returns

T[] - Returns array

Examples

With iteratee

import { pullAllBy } from 'dashlite'

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

Output:

[{ x: 2 }]

Notes

  • This method mutates array

Available since version 1.0.0