Use spread syntax (convert to es2015) (#6317)
This commit is contained in:
1 parent
129fcb6005
commit
59e15ec744
3 files changed
+3
-3
No files matched your search
@@ -7,7 +7,7 @@ function flattenDoc(doc) {
|
||||
for (let i = 0; i < doc.parts.length; ++i) {
|
||||
const doc2 = doc.parts[i];
|
||||
if (typeof doc2 !== "string" && doc2.type === "concat") {
|
||||
[].push.apply(res, flattenDoc(doc2).parts);
|
||||
res.push(...flattenDoc(doc2).parts);
|
||||
} else {
|
||||
const flattened = flattenDoc(doc2);
|
||||
if (flattened !== "") {
|
||||
|
||||
@@ -491,7 +491,7 @@ function printDocToString(doc, options) {
|
||||
case MODE_BREAK:
|
||||
if (lineSuffix.length) {
|
||||
cmds.push([ind, mode, doc]);
|
||||
[].push.apply(cmds, lineSuffix.reverse());
|
||||
cmds.push(...lineSuffix.reverse());
|
||||
lineSuffix = [];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -578,7 +578,7 @@ function normalizeParts(parts) {
|
||||
}
|
||||
|
||||
if (part.type === "concat") {
|
||||
Array.prototype.unshift.apply(restParts, part.parts);
|
||||
restParts.unshift(...part.parts);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user