(
obj: Readonly<{ [key: string]: V }>,
predicate: (value: V, key: string) => boolean,
)
| 28 | predicate: (value: V, key: string) => boolean, |
| 29 | ): { [key: string]: V }; |
| 30 | export 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. |
no test coverage detected