MCPcopy Create free account
hub / github.com/Effect-TS/effect / differenceWith

Function differenceWith

packages/effect/src/Array.ts:3476–3488  ·  view source on GitHub ↗
(isEquivalent: (self: A, that: A) => boolean)

Source from the content-addressed store, hash-verified

3474 * @since 2.0.0
3475 */
3476export const differenceWith = <A>(isEquivalent: (self: A, that: A) => boolean): {
3477 (that: Iterable<A>): (self: Iterable<A>) => Array<A>
3478 (self: Iterable<A>, that: Iterable<A>): Array<A>
3479} => {
3480 const has = containsWith(isEquivalent)
3481 return dual(
3482 2,
3483 (self: Iterable<A>, that: Iterable<A>): Array<A> => {
3484 const thatArray = fromIterable(that)
3485 return fromIterable(self).filter((a) => !has(thatArray, a))
3486 }
3487 )
3488}
3489
3490/**
3491 * Computes elements in the first array that are not in the second, using

Callers 2

Chunk.test.tsFile · 0.50
Array.test.tsFile · 0.50

Calls 4

containsWithFunction · 0.70
fromIterableFunction · 0.70
hasFunction · 0.70
filterMethod · 0.45

Tested by

no test coverage detected