mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
6 lines
222 B
TypeScript
6 lines
222 B
TypeScript
export function partition<T>(array: T[], filter: (element: T) => boolean): [T[], T[]] {
|
|
const pass = [], fail = [];
|
|
array.forEach((element) => (filter(element) ? pass : fail).push(element));
|
|
|
|
return [pass, fail];
|
|
} |