Function
_isSlimmableObject
(key: any, value: any, defaults: any)
Source from the content-addressed store, hash-verified
| 2 | import { isObject } from 'lodash'; |
| 3 | |
| 4 | function _isSlimmableObject(key: any, value: any, defaults: any): boolean { |
| 5 | return ( |
| 6 | defaults != null && |
| 7 | key in defaults && |
| 8 | key !== 'value' && |
| 9 | key !== 'label' && |
| 10 | key !== 'pos' && |
| 11 | isObject(value) && |
| 12 | !('push' in value) |
| 13 | ); |
| 14 | } |
| 15 | |
| 16 | export function makeSlim<T extends object>(root: T, defaults: T): T { |
| 17 | for (const [key, value] of Object.entries(root)) { |
Tested by
no test coverage detected