MCPcopy Index your code
hub / github.com/Effect-TS/effect / intersectionWith

Function intersectionWith

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

Source from the content-addressed store, hash-verified

2346 * @since 2.0.0
2347 */
2348export const intersectionWith = <A>(isEquivalent: (self: A, that: A) => boolean): {
2349 (that: Iterable<A>): (self: Iterable<A>) => Array<A>
2350 (self: Iterable<A>, that: Iterable<A>): Array<A>
2351} => {
2352 const has = containsWith(isEquivalent)
2353 return dual(
2354 2,
2355 (self: Iterable<A>, that: Iterable<A>): Array<A> => {
2356 const bs = fromIterable(that)
2357 return fromIterable(self).filter((a) => has(bs, a))
2358 }
2359 )
2360}
2361
2362/**
2363 * Creates an `Array` of unique values that are included in all given `Iterable`s.

Callers 2

Array.test.tsFile · 0.85
Array.tsFile · 0.85

Calls 3

containsWithFunction · 0.70
fromIterableFunction · 0.70
hasFunction · 0.50

Tested by

no test coverage detected