MCPcopy Create free account
hub / github.com/Snapchat/Valdi / mapValues

Function mapValues

valdi/vscode_debugger/src/common/objUtils.ts:48–59  ·  view source on GitHub ↗
(
  obj: Readonly<{ [key: string]: T }>,
  generator: (value: T, key: string) => R,
)

Source from the content-addressed store, hash-verified

46 * Maps the object values.
47 */
48export function mapValues<T, R>(
49 obj: Readonly<{ [key: string]: T }>,
50 generator: (value: T, key: string) => R,
51): { [key: string]: R } {
52 const next: { [key: string]: R } = {};
53 for (const key of Object.keys(obj)) {
54 const value = obj[key];
55 next[key] = generator(value, key);
56 }
57
58 return next;
59}
60
61/**
62 * Maps the object keys.

Callers 3

sanitizerMethod · 0.90
reportBootTelemetryMethod · 0.90
mapOutputFunction · 0.90

Calls 1

keysMethod · 0.65

Tested by

no test coverage detected