Skip to content
Myr

nit: remove old `each` and rename `eachOwn`

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

authored by aleclarson · committed by Alec Larson · parent 46cc6a1 · Browse files · 3 files+8 added−18 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+8 added−18 removed

  • other:+8 added−18 removed

3 files+8 added−18 removed

modified:src/common.js-8 removed
modified:src/es5.js+3 added-4 removed
5 unmodified lines
6 has,7 is,8 isDraft,9 isDraftable,10 isEnumerable,11 shallowCopy,11 DRAFT_STATE,12 eachOwn,13 isEnumerable12 DRAFT_STATE13} from "./common"1415const descriptors = {}16
13 unmodified lines
3031export function createDraft(base, parent) {32 const isArray = Array.isArray(base)33 const draft = clonePotentialDraft(base)35 eachOwn(draft, prop => {34 each(draft, prop => {35 proxyProperty(draft, prop, isArray || isEnumerable(base, prop))36 })3738 // See "proxy.js" for property documentation.
196 unmodified lines
modified:src/immer.js+5 added-6 removed
6 unmodified lines
7 has,8 is,9 isDraft,10 isDraftable,11 isEnumerable,12 shallowCopy,13 DRAFT_STATE,13 NOTHING,14 isEnumerable,15 eachOwn14 NOTHING15} from "./common"1617function verifyMinified() {}18
123 unmodified lines
142 if (!assigned[prop]) this.onDelete(state, prop)143 }144 } else {145 const {base, copy} = state147 eachOwn(base, prop => {146 each(base, prop => {147 if (!has(copy, prop)) this.onDelete(state, prop)148 })149 }150 }
55 unmodified lines
206 return207 }208 // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.209 else if (isDraftable(value) && !Object.isFrozen(value)) {211 eachOwn(value, finalizeProperty)210 each(value, finalizeProperty)211 }212213 if (inDraft && onAssign) {214 onAssign(state, prop, value)215 }216 }217219 eachOwn(root, finalizeProperty)218 each(root, finalizeProperty)219 return root220 }221}