From a21555c8cd069ec33cbde5c08a44db55a39eaf74 Mon Sep 17 00:00:00 2001 From: "Xin Du (Clark)" Date: Fri, 26 Apr 2019 20:16:16 +0100 Subject: [PATCH] fix(utils): node v8 not support dotAll in regex (#5608) --- packages/utils/src/serialize.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/utils/src/serialize.js b/packages/utils/src/serialize.js index 87faf963e6..9c09f83915 100644 --- a/packages/utils/src/serialize.js +++ b/packages/utils/src/serialize.js @@ -14,11 +14,11 @@ export function normalizeFunctions(obj) { } if (typeof obj[key] === 'function') { const asString = obj[key].toString() - const match = asString.match(/^([^{(]+)=>\s*(.*)/s) + const match = asString.match(/^([^{(]+)=>\s*([\0-\uFFFF]*)/) if (match) { - const fullFunctionBody = match[2].match(/^{?(\s*return\s+)?(.*?)}?$/s) + const fullFunctionBody = match[2].match(/^{?(\s*return\s+)?([\0-\uFFFF]*?)}?$/) let functionBody = fullFunctionBody[2].trim() - if (fullFunctionBody[1] || !match[2].trim().match(/^\s*{/s)) { + if (fullFunctionBody[1] || !match[2].trim().match(/^\s*{/)) { functionBody = `return ${functionBody}` } // eslint-disable-next-line no-new-func