MCPcopy Index your code
hub / github.com/TanStack/db / map

Method map

packages/db/src/collection/index.ts:557–570  ·  view source on GitHub ↗

* Create a new array with the results of calling a function for each entry in the collection

(
    callbackfn: (
      value: WithVirtualProps<TOutput, TKey>,
      key: TKey,
      index: number,
    ) => U,
  )

Source from the content-addressed store, hash-verified

555 * Create a new array with the results of calling a function for each entry in the collection
556 */
557 public map<U>(
558 callbackfn: (
559 value: WithVirtualProps<TOutput, TKey>,
560 key: TKey,
561 index: number,
562 ) => U,
563 ): Array<U> {
564 const result: Array<U> = []
565 let index = 0
566 for (const [key, value] of this.entries()) {
567 result.push(callbackfn(value, key, index++))
568 }
569 return result
570 }
571
572 public getKeyFromItem(item: TOutput): TKey {
573 return this.config.getKey(item)

Callers 15

createArrayChangeProxyFunction · 0.45
constructorMethod · 0.45
emitEventsMethod · 0.45
toSerializableIndexValueFunction · 0.45
validateDataMethod · 0.45
updateMethod · 0.45
getOrderedKeysFunction · 0.45

Calls 1

entriesMethod · 0.95

Tested by 15

stripVirtualOnlyUpdatesFunction · 0.36
stripValuesFunction · 0.36
stripEntriesFunction · 0.36
stripChangesFunction · 0.36
getStateEntriesFunction · 0.36
mutationFnFunction · 0.36
normalizeChangesFunction · 0.36
createBasicTestsFunction · 0.36
testJoinTypeFunction · 0.36
createJoinTestsFunction · 0.36
createSubqueryTestsFunction · 0.36
createJoinSubqueryTestsFunction · 0.36