Use spread syntax (convert to es2015) (#6317)

This commit is contained in:
Shinigami authored and GitHub committed 2020-02-25 03:05:49 +02:00
1 parent 129fcb6005
commit 59e15ec744
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -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 !== "") {
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -578,7 +578,7 @@ function normalizeParts(parts) {
}
if (part.type === "concat") {
Array.prototype.unshift.apply(restParts, part.parts);
restParts.unshift(...part.parts);
continue;
}