MCPcopy Create free account
hub / github.com/TanStack/db / keyBy

Function keyBy

packages/db-ivm/src/operators/keying.ts:13–17  ·  view source on GitHub ↗
(
  keyFn: (value: T) => K,
)

Source from the content-addressed store, hash-verified

11 * @param keyFn - Function to generate the key for each value
12 */
13export function keyBy<T, K>(
14 keyFn: (value: T) => K,
15): PipedOperator<T, Keyed<K, T>> {
16 return map((value: T): Keyed<K, T> => [keyFn(value), value])
17}
18
19/**
20 * Removes the key from a keyed stream

Callers 2

keying.test.tsFile · 0.85

Calls 1

mapFunction · 0.85

Tested by

no test coverage detected