Function
include
(obj: Record<string, unknown> | unknown[], ...vals: unknown[])
Source from the content-addressed store, hash-verified
| 125 | } |
| 126 | |
| 127 | function include(obj: Record<string, unknown> | unknown[], ...vals: unknown[]) { |
| 128 | if (Array.isArray(obj)) { |
| 129 | return obj.filter(o => vals.includes(o)); |
| 130 | } else { |
| 131 | return Object.keys(obj) |
| 132 | .filter(k => { |
| 133 | return vals.includes(k); |
| 134 | }) |
| 135 | .reduce((acc, curr) => ({ ...acc, [curr]: obj[curr] }), {}); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | export default fp(shadowCapture); |
Tested by
no test coverage detected