Skip to content

Commit 086b395

Browse files
committed
fix: only slice transpiled code if wrapped in block
1 parent 42fa10e commit 086b395

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ export function parseFunction(fn, presetOptions = {}) {
8686
}
8787
)
8888

89-
// remove block statement needed to transform & trim block whitespace
90-
parsed.body = transpiled.code.slice(1, -1).trim()
89+
if (transpiled.code.substr(0, 1) === '{') {
90+
// remove block statement needed to transform & trim block whitespace
91+
parsed.body = transpiled.code.slice(1, -1).trim()
92+
} else {
93+
parsed.body = transpiled.code
94+
}
9195

9296
if (!fnCache[fnString]) {
9397
fnCache[fnString] = {}

0 commit comments

Comments
 (0)