Skip to content
Myr

chore: comments and formatting

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alec Larson · committed by Alec Larson · parent ec00ee4 · Browse files · 3 files+10 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−4 removed

  • other:+10 added−4 removed

3 files+10 added−4 removed

modified:src/common.js+4 added-3 removed
modified:src/immer.js+1 added
226 unmodified lines
227 finalizeTree(root, rootPath, scope) {228 const state = root[DRAFT_STATE]229 if (state) {230 if (!this.useProxies) {231 // Create the final copy, with added keys and without deleted keys.232 state.finalizing = true233 state.copy = shallowCopy(state.draft, true)234 state.finalizing = false235 }
54 unmodified lines
modified:src/proxy.js+5 added-1 removed
117 unmodified lines
118 return drafts[prop]119 }120121 const value = source(state)[prop]122 if (state.finalized || !isDraftable(value)) return value122 if (state.finalized || !isDraftable(value)) {123 return value124 }125126 // Check for existing draft in modified state.127 if (state.modified) {128 // Assigned values are never drafted. This catches any drafts we created, too.
31 unmodified lines
160 if (state.copy) delete state.copy[prop]161 return true162}163164// Note: We never coerce `desc.value` into an Immer draft, because we can't make165// the same guarantee in ES5 mode.166function getOwnPropertyDescriptor(state, prop) {167 const owner = source(state)168 const desc = Reflect.getOwnPropertyDescriptor(owner, prop)169 if (desc) {
14 unmodified lines