MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / dedupeArrayById

Function dedupeArrayById

packages/shared/src/utils.ts:185–195  ·  view source on GitHub ↗
(input: T[])

Source from the content-addressed store, hash-verified

183}[keyof T]
184
185export function dedupeArrayById<T extends {id: unknown}>(input: T[]): T[] {
186 const ids = new Set<unknown>()
187 const deduped: T[] = []
188 for (let i = input.length - 1; i >= 0; i--) {
189 const update = input[i]!
190 if (ids.has(update.id)) continue
191 ids.add(update.id)
192 deduped.push(update)
193 }
194 return deduped
195}
196
197export function mutate_filter<T>(array: T[], callback: (item: T) => boolean): void {
198 for (let i = array.length - 1; i >= 0; i--) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…