(isEquivalent: (self: A, that: A) => boolean)
| 3397 | * @since 2.0.0 |
| 3398 | */ |
| 3399 | export const intersectionWith = <A>(isEquivalent: (self: A, that: A) => boolean): { |
| 3400 | (that: Iterable<A>): (self: Iterable<A>) => Array<A> |
| 3401 | (self: Iterable<A>, that: Iterable<A>): Array<A> |
| 3402 | } => { |
| 3403 | const has = containsWith(isEquivalent) |
| 3404 | return dual( |
| 3405 | 2, |
| 3406 | (self: Iterable<A>, that: Iterable<A>): Array<A> => { |
| 3407 | const thatArray = fromIterable(that) |
| 3408 | return fromIterable(self).filter((a) => has(thatArray, a)) |
| 3409 | } |
| 3410 | ) |
| 3411 | } |
| 3412 | |
| 3413 | /** |
| 3414 | * Computes the intersection of two arrays using `Equal.asEquivalence()`. Order is |
no test coverage detected