perf: minor tweaks

This commit is contained in:
Evan You
2019-10-16 23:12:57 -04:00
parent 4771319a15
commit e3b68972d8
3 changed files with 19 additions and 21 deletions

View File

@@ -12,8 +12,9 @@ const builtInSymbols = new Set(
)
function createGetter(isReadonly: boolean) {
return function get(target: any, key: string | symbol, receiver: any) {
const res = Reflect.get(target, key, receiver)
return function get(target: any, key: string | symbol) {
// not using Reflect.get here for perf reasons
const res = target[key]
if (isSymbol(key) && builtInSymbols.has(key)) {
return res
}