Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8f7bfa

Browse files
committed
fix(serialization.js): Handle 'async' functions
1 parentb7d8829 commitf8f7bfa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎serialization.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ function serialize(value) {
4242
}
4343

4444
if('function'===typeofvalue){
45-
if('function'!==value.toString().slice(0,8)){
46-
if('('!==value.toString()[0]){
47-
value=`function${value}`
45+
constoriginal=value
46+
constisAsync=value.toString().match(/^async\s+/)
47+
letstring=value.toString().replace(/^async\s+/,'')
48+
if(!/^function/.test(string)){
49+
if('('!==string.toString()[0]){
50+
value=`${isAsync ?'async ' :''}function${string}`
4851
}
4952
}
5053

54+
5155
try{
5256
constsource=`return${value.toString()}`
5357
returnString(newFunction(source))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp