Skip to content
Myr

More code dedupping

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

authored by Michel Weststrate · committed by Michel Weststrate · parent ee544cc · Browse files · 3 files+14 added−27 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+14 added−27 removed

  • other:+14 added−27 removed

3 files+14 added−27 removed

modified:src/common.js+13 added-7 removed
modified:src/es5.js-9 removed
129 unmodified lines
130function hasArrayChanges(state) {131 return state.proxy.length !== state.base.length132}133134export function finalizeObject(proxy, state) {135 const res = (state.copy = shallowCopy(proxy))136 const base = state.base137 each(res, (prop, value) => {138 if (value !== base[prop]) res[prop] = finalize(value)139 })140 return freeze(res)141}142134export function produceEs5(baseState, producer) {135 const prevStates = states136 states = []137 try {
54 unmodified lines
modified:src/proxy.js+1 added-11 removed
8 unmodified lines
9 PROXY_STATE,10 finalize,11 shallowCopy,12 verifyReturnValue,13 each,14 finalizeNonProxiedObject13 each14} from "./common"1516let proxies = null17
109 unmodified lines
127 proxies.push(proxy)128 return proxy.proxy129}130132export function finalizeObject(state) {133 const copy = state.copy134 const base = state.base135 each(copy, (prop, value) => {136 if (value !== base[prop]) copy[prop] = finalize(value)137 })138 return freeze(copy)139}140131export function produceProxy(baseState, producer) {132 const previousProxies = proxies133 proxies = []134 try {
13 unmodified lines