From 35f658db9f7f148cd14d4902daab752295a7e90f Mon Sep 17 00:00:00 2001 From: HcySunYang Date: Mon, 30 Dec 2019 20:42:22 +0800 Subject: [PATCH] fix: correct the symbol check close #116 --- src/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index fa367d3a..d5da2107 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -2,7 +2,13 @@ import Vue from 'vue'; const toString = (x: any) => Object.prototype.toString.call(x); -export const hasSymbol = typeof Symbol === 'function' && Symbol.for; +export function isNative (Ctor: any): boolean { + return typeof Ctor === 'function' && /native code/.test(Ctor.toString()) +} + +export const hasSymbol = + typeof Symbol !== 'undefined' && isNative(Symbol) && + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys) export const noopFn: any = (_: any) => _;