Skip to content
Myr

`in` -> `Object.hasOwnProperty`

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 ad5a86a · Browse files · 2 files+8 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

2 files+8 added−4 removed

  • other:+8 added−4 removed

2 files+8 added−4 removed

modified:src/common.js+4 added
modified:src/proxy.js+4 added-4 removed
1 unmodified line
2// @ts-check34import {5 is,6 has,7 isProxyable,8 isProxy,9 freeze,10 PROXY_STATE,
54 unmodified lines
65 // (new objects don't need proxying, they will be processed in finalize anyway)66 return (state.copy[prop] = createProxy(state, value))67 return value68 } else {68 if (prop !== "constructor" && prop in state.proxies)69 return state.proxies[prop]69 if (has(state.proxies, prop)) return state.proxies[prop]70 const value = state.base[prop]71 if (!isProxy(value) && isProxyable(value))72 return (state.proxies[prop] = createProxy(state, value))73 return value
3 unmodified lines
77function set(state, prop, value) {78 if (!state.modified) {79 if (80 (prop in state.base && is(state.base[prop], value)) ||81 (prop in state.proxies && state.proxies[prop] === value)81 (has(state.proxies, prop) && state.proxies[prop] === value)82 )83 return true84 markChanged(state)85 }
9 unmodified lines
9596function getOwnPropertyDescriptor(state, prop) {97 const owner = state.modified98 ? state.copy99 : prop in state.proxies ? state.proxies : state.base99 : has(state.proxies, prop) ? state.proxies : state.base100 const descriptor = Reflect.getOwnPropertyDescriptor(owner, prop)101 if (descriptor && !(Array.isArray(owner) && prop === "length"))102 descriptor.configurable = true103 return descriptor
45 unmodified lines