(isEquivalent: (self: A, that: A) => boolean)
| 3474 | * @since 2.0.0 |
| 3475 | */ |
| 3476 | export 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 |
no test coverage detected