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

Method map

packages/db/src/collection/state.ts:455–464  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

453 * Create a new array with the results of calling a function for each entry in the collection
454 */
455 public map<U>(
456 callbackfn: (value: TOutput, key: TKey, index: number) => U,
457 ): Array<U> {
458 const result: Array<U> = []
459 let index = 0
460 for (const [key, value] of this.entries()) {
461 result.push(callbackfn(value, key, index++))
462 }
463 return result
464 }
465
466 /**
467 * Check if the given collection is this collection

Callers

nothing calls this directly

Calls 1

entriesMethod · 0.95

Tested by

no test coverage detected