From c18c80c65a51b34825614c264f872c3aacba7373 Mon Sep 17 00:00:00 2001 From: Sebastian Speitel Date: Wed, 8 Jan 2020 00:10:51 +0100 Subject: [PATCH] Predefine typeCheck RegExp --- src/core/util/props.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/util/props.js b/src/core/util/props.js index 1b57f77cdb5..f5b867e9266 100644 --- a/src/core/util/props.js +++ b/src/core/util/props.js @@ -174,13 +174,15 @@ function assertType (value: any, type: Function): { } } +const functionTypeCheckRE = /^\s*function (\w+)/ + /** * Use function string name to check built-in types, * because a simple equality check will fail when running * across different vms / iframes. */ function getType (fn) { - const match = fn && fn.toString().match(/^\s*function (\w+)/) + const match = fn && fn.toString().match(functionTypeCheckRE) return match ? match[1] : '' }