MCPcopy Create free account
hub / github.com/BuilderIO/framework-benchmarks / mapValues

Function mapValues

apps/components/src/utils/map-keys.ts:1–9  ·  view source on GitHub ↗
(
  obj: { [key: string]: T },
  fn: (value: T, key: string) => U
)

Source from the content-addressed store, hash-verified

1export function mapValues<T, U>(
2 obj: { [key: string]: T },
3 fn: (value: T, key: string) => U
4): { [key: string]: U } {
5 return Object.keys(obj).reduce((result, key) => {
6 result[key] = fn(obj[key], key);
7 return result;
8 }, {} as { [key: string]: U });
9}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected