Added fbjs link
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 783f957 · Browse files · 1 file·+8 added−7 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+8 added−7 removed
- other:+8 added−7 removed
Provenance
- Commit
855603d- Tree
7206449- Author
Michel Weststrate <mweststrate@gmail.com>- Committer
Michel Weststrate <mweststrate@gmail.com>- Parent
783f957
1 file changed+8 added−7 removed
modified:immer-es5.js+8 added-7 removed
30 unmodified lines31 32 function assertUnfinished() {33 if (finished)34 throw new Error(35- "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process?",35+ "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process?"36 )37 }38 39 function proxySet(target, prop, value) {7 unmodified lines47 Object.defineProperty(target, prop, {48 enumerable: true,49 writable: true,50 configurable: true,51- value: value,51+ value: value52 })53 }54 55 function createPropertyProxy(prop) {24 unmodified lines80 return proxy81 },82 set(value) {83 proxySet(this, prop, value)84- },84+ }85 })86 return proxy87 },88 set(value) {89 proxySet(this, prop, value)90- },90+ }91 })92 )93 }94 1 unmodified line96 const proxy = {}97 createHiddenProperty(proxy, PROXY_TARGET, base)98 createHiddenProperty(proxy, CHANGED_STATE, false)99 Object.keys(base).forEach(prop =>100- Object.defineProperty(proxy, prop, createPropertyProxy(prop)),100+ Object.defineProperty(proxy, prop, createPropertyProxy(prop))101 )102 return proxy103 }104 61 unmodified lines166 const maybeVoidReturn = thunk(rootClone)167 //values either than undefined will trigger warning;168 !Object.is(maybeVoidReturn, undefined) &&169 console.warn(170- `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`,170+ `Immer callback expects no return value. However ${typeof maybeVoidReturn} was returned`171 )172 // and finalize the modified proxy173 finalizing = true174 const res = finalize(rootClone)22 unmodified lines197 function createHiddenProperty(target, prop, value) {198 Object.defineProperty(target, prop, {199 value: value,200 enumerable: false,201- writable: true,201+ writable: true202 })203 }204 205 function shallowEqual(objA, objB) {206+ //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js207 if (Object.is(objA, objB)) return true208 if (209 typeof objA !== "object" ||210 objA === null ||34 unmodified lines