(arr: T[], predicate: (item: T) => boolean)
| 193 | * @internal |
| 194 | */ |
| 195 | export function partition<T>(arr: T[], predicate: (item: T) => boolean): [T[], T[]] { |
| 196 | const satisfies: T[] = [] |
| 197 | const doesNotSatisfy: T[] = [] |
| 198 | for (const item of arr) { |
| 199 | if (predicate(item)) { |
| 200 | satisfies.push(item) |
| 201 | } else { |
| 202 | doesNotSatisfy.push(item) |
| 203 | } |
| 204 | } |
| 205 | return [satisfies, doesNotSatisfy] |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Check if two arrays are shallow equal. |
no test coverage detected
searching dependent graphs…