fix: serialize external function (#4916)

This commit is contained in:
Jonas Galvez 2019-02-01 11:31:16 -02:00 committed by Pooya Parsa
parent 32b0f155c9
commit 14f43da9b2

View File

@ -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