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

Function filterValues

valdi/vscode_debugger/src/common/objUtils.ts:30–43  ·  view source on GitHub ↗
(
  obj: Readonly<{ [key: string]: V }>,
  predicate: (value: V, key: string) => boolean,
)

Source from the content-addressed store, hash-verified

28 predicate: (value: V, key: string) => boolean,
29): { [key: string]: V };
30export function filterValues<V>(
31 obj: Readonly<{ [key: string]: V }>,
32 predicate: (value: V, key: string) => boolean,
33): { [key: string]: V } {
34 const next: { [key: string]: V } = {};
35 for (const key of Object.keys(obj)) {
36 const value = obj[key];
37 if (predicate(value, key)) {
38 next[key] = value;
39 }
40 }
41
42 return next;
43}
44
45/**
46 * Maps the object values.

Callers 3

removeNullsFunction · 0.85
removeUndefinedFunction · 0.85

Calls 1

keysMethod · 0.65

Tested by

no test coverage detected