[tools] Refactor, use built-in Array.flat() instead of custom flatten method

Change-Id: I0e4de2d943db5a6af41bb1a1599e0ebb0568d290
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2912881
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74849}
This commit is contained in:
Wael Almattar 2021-05-25 14:56:45 +02:00 committed by V8 LUCI CQ
parent ff9a6689df
commit 8a94daf518
2 changed files with 2 additions and 4 deletions

View File

@ -228,6 +228,7 @@ Victor Costan <costan@gmail.com>
Vlad Burlik <vladbph@gmail.com>
Vladimir Krivosheev <develar@gmail.com>
Vladimir Shutoff <vovan@shutoff.ru>
Wael Almattar <waelsy123@gmail.com>
Wei Wu <lazyparser@gmail.com>
Wenlu Wang <kingwenlu@gmail.com>
Wenyu Zhao <wenyu.zhao@anu.edu.au>

View File

@ -24,9 +24,6 @@ import { Root } from 'protobufjs';
// JSON fields it will include/exclude based on the data present in the trace
// event.
// TODO(petermarshall): Replace with Array#flat once it lands in Node.js.
const flatten = <T>(a: T[], b: T[]) => { a.push(...b); return a; }
// Convert a string representing an int or uint (64 bit) to a Number or throw
// if the value won't fit.
function parseIntOrThrow(int: string) {
@ -124,7 +121,7 @@ async function main() {
}, {})
};
}))
.reduce(flatten, [])
.flat()
};
await fs.promises.writeFile(process.argv[4], JSON.stringify(output, null, 2));
}