Skip to content
Myr

Simple optimization in ES5

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 4e7f44a · Browse files · 2 files+2 added−13 removed
This commit

State

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

Diff stats

2 files+2 added−13 removed

  • other:+2 added−13 removed

2 files+2 added−13 removed

modified:es5.js+2 added-2 removed
98 unmodified lines
99 )100 }101102 function createObjectProxy(base) {103 const proxy = {}103 const proxy = Object.assign({}, base)104 Object.keys(base).forEach(prop =>105 Object.defineProperty(proxy, prop, createPropertyProxy(prop))106 )107 return proxy108 }109110 function createArrayProxy(base) {111 const proxy = []111 const proxy = new Array(base.length)112 for (let i = 0; i < base.length; i++)113 Object.defineProperty(proxy, "" + i, createPropertyProxy("" + i))114 return proxy115 }
144 unmodified lines
modified:immer.js-11 removed
33 unmodified lines
34function immer(baseState, thunk) {35 const revocableProxies = []3637 class State {38 // /** @type {boolean} */39 // modified40 // /** @type {State} */41 // parent42 // /** @type {any} */43 // base44 // /** @type {any} */45 // copy46 // /** @type {any} */47 // proxies4838 constructor(parent, base) {39 this.modified = false40 this.parent = parent41 this.base = base
227 unmodified lines