Skip to content

Commit

Permalink
remove unnecessary map call
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallmain committed Mar 13, 2020
1 parent 56a65ac commit 9879a78
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions x-pack/plugins/endpoint/scripts/resolver_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,12 @@ async function main() {
argv.percentWithRelated,
argv.percentTerminated
);
const body = resolverDocs
.map(doc => [{ index: { _index: argv.eventIndex } }, doc])
.reduce((array, value) => (array.push(...value), array), []);
const body = resolverDocs.reduce(
(array: Array<Record<string, any>>, doc) => (
array.push({ index: { _index: argv.eventIndex } }, doc), array
),
[]
);

await client.bulk({ body });
}
Expand Down

0 comments on commit 9879a78

Please sign in to comment.