( array: T[], equal: (a: T, b: T) => boolean, )
| 120 | } |
| 121 | |
| 122 | export function deduplicateArray<T>( |
| 123 | array: T[], |
| 124 | equal: (a: T, b: T) => boolean, |
| 125 | ): T[] { |
| 126 | const result: T[] = []; |
| 127 | |
| 128 | for (const item of array) { |
| 129 | if (!result.some((existingItem) => equal(existingItem, item))) { |
| 130 | result.push(item); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | return result; |
| 135 | } |
| 136 | |
| 137 | export type TODO = any; |
| 138 |
no test coverage detected