Skip to content

Commit

Permalink
Removed flatMap, added TODOs and link to GH issue
Browse files Browse the repository at this point in the history
  • Loading branch information
alxmrs committed Mar 3, 2020
1 parent 472bc84 commit 140111f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export class Manifest {
return [...new Set(this._findAll(manifest => manifest._recipes))];
}
get allHandles() {
// Reduce is equivalent to flatMap
// TODO(#4820) Update `reduce` to use flatMap
return [...new Set(this._findAll(manifest => manifest._recipes.reduce((acc, x) => acc.concat(x.handles), [])))];
}
get activeRecipe() {
Expand Down Expand Up @@ -329,8 +329,9 @@ export class Manifest {
function fatePredicate(handle: Handle) {
return fates === [] || fates.includes(handle.fate);
}
// TODO(#4820) Update `reduce` to use flatMap
return [...this._findAll(manifest => manifest._recipes
.flatMap(r => r.handles)
.reduce((acc, r) => acc.concat(r.handles), [])
.filter(h => this._typePredicate(h, type, subtype) && tagPredicate(h) && fatePredicate(h)))];
}
findHandlesById(id: string): Handle[] {
Expand Down

0 comments on commit 140111f

Please sign in to comment.