unexpected
Advanced tools
Comparing version 10.20.0 to 10.21.0
@@ -767,7 +767,9 @@ var utils = require('./utils'); | ||
var body; | ||
var matchSource = source.match(/^\s*function \w*?\s*\(([^\)]*)\)\s*\{([\s\S]*?( *)?)\}\s*$/); | ||
var asyncPrefix = ''; | ||
var matchSource = source.match(/^\s*(async )?function \w*?\s*\(([^\)]*)\)\s*\{([\s\S]*?( *)?)\}\s*$/); | ||
if (matchSource) { | ||
args = matchSource[1]; | ||
body = matchSource[2]; | ||
var bodyIndent = matchSource[3] || ''; | ||
asyncPrefix = matchSource[1] || ''; | ||
args = matchSource[2]; | ||
body = matchSource[3]; | ||
var bodyIndent = matchSource[4] || ''; | ||
// Remove leading indentation unless the function is a one-liner or it uses multiline string literals | ||
@@ -797,3 +799,3 @@ if (/\n/.test(body) && !/\\\n/.test(body)) { | ||
} | ||
return output.code('function ' + name + '(' + args + ') {' + body + '}', 'javascript'); | ||
return output.code(asyncPrefix + 'function ' + name + '(' + args + ') {' + body + '}', 'javascript'); | ||
} | ||
@@ -800,0 +802,0 @@ }); |
{ | ||
"name": "unexpected", | ||
"version": "10.20.0", | ||
"version": "10.21.0", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
769892
19257