2020-09-25 17:39:21 +02:00
|
|
|
/*
|
2024-09-09 15:57:16 +02:00
|
|
|
* Copyright 2024 New Vector Ltd.
|
2020-09-25 17:39:21 +02:00
|
|
|
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
|
|
|
*
|
2024-09-09 15:57:16 +02:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
|
|
* Please see LICENSE files in the repository root for full details.
|
2020-09-25 17:39:21 +02:00
|
|
|
*/
|
|
|
|
|
2022-07-11 07:52:44 +02:00
|
|
|
import { arrayDiff, arrayIntersection } from "./arrays";
|
2020-11-18 04:38:59 +01:00
|
|
|
|
2021-12-13 11:57:51 +01:00
|
|
|
export function iterableIntersection<T>(a: Iterable<T>, b: Iterable<T>): Iterable<T> {
|
|
|
|
return arrayIntersection(Array.from(a), Array.from(b));
|
|
|
|
}
|
|
|
|
|
2022-12-12 12:24:14 +01:00
|
|
|
export function iterableDiff<T>(a: Iterable<T>, b: Iterable<T>): { added: Iterable<T>; removed: Iterable<T> } {
|
2020-11-18 04:38:59 +01:00
|
|
|
return arrayDiff(Array.from(a), Array.from(b));
|
|
|
|
}
|