From 14f43da9b2ef61afec30cbf2998ed4b91342b246 Mon Sep 17 00:00:00 2001 From: Jonas Galvez Date: Fri, 1 Feb 2019 11:31:16 -0200 Subject: [PATCH] fix: serialize external function (#4916) --- packages/utils/src/serialize.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/utils/src/serialize.js b/packages/utils/src/serialize.js index d04bd31194..1ce3f17490 100644 --- a/packages/utils/src/serialize.js +++ b/packages/utils/src/serialize.js @@ -1,4 +1,3 @@ - import serialize from 'serialize-javascript' export function serializeFunction(func) { @@ -15,7 +14,7 @@ export function serializeFunction(func) { return _ } }) - .replace(`${func.name}(`, 'function (') + .replace(`${func.name || 'function'}(`, 'function (') } serializeFunction.internalFunctionRE = /^(\s*)(?!(?:if)|(?:for)|(?:while)|(?:switch))(\w+)\s*\((.*?)\)\s*\{/gm