Skip to content

Commit b9a4d8d

Browse files
a631807682yyx990803
authored andcommitted
refactor(reactivity): use function isSymbol instead of typeof (vuejs#155)
1 parent b255f42 commit b9a4d8d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/reactivity/src/baseHandlers.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import { reactive, readonly, toRaw } from './reactive'
22
import { OperationTypes } from './operations'
33
import { track, trigger } from './effect'
44
import { LOCKED } from './lock'
5-
import { isObject, hasOwn } from '@vue/shared'
5+
import { isObject, hasOwn, isSymbol } from '@vue/shared'
66
import { isRef } from './ref'
77

88
const builtInSymbols = new Set(
99
Object.getOwnPropertyNames(Symbol)
1010
.map(key => (Symbol as any)[key])
11-
.filter(value => typeof value === 'symbol')
11+
.filter(isSymbol)
1212
)
1313

1414
function createGetter(isReadonly: boolean) {
1515
return function get(target: any, key: string | symbol, receiver: any) {
1616
const res = Reflect.get(target, key, receiver)
17-
if (typeof key === 'symbol' && builtInSymbols.has(key)) {
17+
if (isSymbol(key) && builtInSymbols.has(key)) {
1818
return res
1919
}
2020
if (isRef(res)) {

0 commit comments

Comments
 (0)