Merge pull request #1026 from ochen1/patch-3

Add support for Discord's new endpoints to update roles
This commit is contained in:
Madeline authored and GitHub committed 2023-04-11 13:20:09 +10:00
commit f040caa712
5 files changed
+149 -8

No files matched your search

+8
View File
@@ -21,3 +21,11 @@
export function containsAll(arr: unknown[], target: unknown[]) {
return target.every((v) => arr.includes(v));
}
/* https://stackoverflow.com/a/50636286 */
export function partition<T>(array: T[], filter: (elem: T) => boolean) {
const pass: T[] = [],
fail: T[] = [];
array.forEach((e) => (filter(e) ? pass : fail).push(e));
return [pass, fail];
}