( obj: IdObj<Value>, id: Id | number, getDefaultValue: () => Value, )
| 94 | }; |
| 95 | |
| 96 | export const objEnsure = <Value>( |
| 97 | obj: IdObj<Value>, |
| 98 | id: Id | number, |
| 99 | getDefaultValue: () => Value, |
| 100 | ): Value => { |
| 101 | if (!objHas(obj, id as Id)) { |
| 102 | obj[id] = getDefaultValue(); |
| 103 | } |
| 104 | return obj[id] as Value; |
| 105 | }; |
| 106 | |
| 107 | export const objValidate = ( |
| 108 | obj: IdObj<any> | undefined, |
no test coverage detected
searching dependent graphs…