Type of elements within the source iterable.
Type produced by keySelector.
The source iterable.
Sequence whose elements define the keys that should be excluded.
Selector used to project each element to the key used for comparison.
OptionalkeyComparator: EqualityComparator<TKey, TKey> | OrderComparator<TKey, TKey>Optional comparator used to compare keys. Both equality and order comparators are supported; defaults to the library's standard equality comparison when omitted.
A sequence that contains the elements from source whose keys are absent from other.
Source ordering is preserved and duplicate elements with distinct keys remain. other is fully enumerated to materialise the exclusion keys.
const products1 = [
{ name: 'Apple', category: 'Fruit' },
{ name: 'Banana', category: 'Fruit' },
{ name: 'Carrot', category: 'Vegetable' },
];
const products2 = [
{ name: 'Broccoli', category: 'Vegetable' },
];
const result = exceptBy(products1, products2, p => p.category).toArray();
console.log(result);
// [
// { name: 'Apple', category: 'Fruit' },
// { name: 'Banana', category: 'Fruit' }
// ]
Returns the elements of source whose projected keys are not present in other.