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

Function differenceWith

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

Source from the content-addressed store, hash-verified

3313 * @since 2.0.0
3314 */
3315export const differenceWith = <A>(isEquivalent: (self: A, that: A) => boolean): {
3316 (that: Iterable<A>): (self: Iterable<A>) => Array<A>
3317 (self: Iterable<A>, that: Iterable<A>): Array<A>
3318} => {
3319 const has = containsWith(isEquivalent)
3320 return dual(
3321 2,
3322 (self: Iterable<A>, that: Iterable<A>): Array<A> => {
3323 const thatArray = fromIterable(that)
3324 return fromIterable(self).filter((a) => !has(thatArray, a))
3325 }
3326 )
3327}
3328
3329/**
3330 * 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

filterMethod · 0.80
containsWithFunction · 0.70
fromIterableFunction · 0.70
hasFunction · 0.70

Tested by

no test coverage detected