MCPcopy
hub / github.com/TanStack/query / uniqueBy

Function uniqueBy

packages/eslint-plugin-query/src/utils/unique-by.ts:1–3  ·  view source on GitHub ↗
(arr: Array<T>, fn: (x: T) => unknown)

Source from the content-addressed store, hash-verified

1export function uniqueBy<T>(arr: Array<T>, fn: (x: T) => unknown): Array<T> {
2 return arr.filter((x, i, a) => a.findIndex((y) => fn(x) === fn(y)) === i)
3}

Callers 2

getExternalRefsFunction · 0.90

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…