(value: any)
| 19 | } |
| 20 | |
| 21 | function currentImpl(value: any): any { |
| 22 | if (!isDraftable(value) || isFrozen(value)) return value |
| 23 | const state: ImmerState | undefined = value[DRAFT_STATE] |
| 24 | let copy: any |
| 25 | let strict = true // Default to strict for compatibility |
| 26 | if (state) { |
| 27 | if (!state.modified_) return state.base_ |
| 28 | // Optimization: avoid generating new drafts during copying |
| 29 | state.finalized_ = true |
| 30 | copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_) |
| 31 | strict = state.scope_.immer_.shouldUseStrictIteration() |
| 32 | } else { |
| 33 | copy = shallowCopy(value, true) |
| 34 | } |
| 35 | // recurse |
| 36 | each( |
| 37 | copy, |
| 38 | (key, childValue) => { |
| 39 | set(copy, key, currentImpl(childValue)) |
| 40 | }, |
| 41 | strict |
| 42 | ) |
| 43 | if (state) { |
| 44 | state.finalized_ = false |
| 45 | } |
| 46 | return copy |
| 47 | } |
no test coverage detected
searching dependent graphs…