Merge pull request #1026 from ochen1/patch-3

Add support for Discord's new endpoints to update roles
This commit is contained in:
Madeline
2023-04-11 13:20:09 +10:00
committed by GitHub
5 changed files with 149 additions and 8 deletions
+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];
}