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