Space preferences for whether or not you see DMs in a Space (#7250)

This commit is contained in:
Michael Telatynski 2021-12-17 09:26:32 +00:00 committed by GitHub
parent 5ee356daaa
commit 39c4b78371
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 911 additions and 350 deletions

View file

@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { arrayDiff, Diff } from "./arrays";
/**
* Determines if two sets are different through a shallow comparison.
* @param a The first set. Must be defined.
@ -32,3 +34,13 @@ export function setHasDiff<T>(a: Set<T>, b: Set<T>): boolean {
return true; // different lengths means they are naturally diverged
}
}
/**
* Determines the values added and removed between two sets.
* @param a The first set. Must be defined.
* @param b The second set. Must be defined.
* @returns The difference between the values in each set.
*/
export function setDiff<T>(a: Set<T>, b: Set<T>): Diff<T> {
return arrayDiff(Array.from(a), Array.from(b));
}