Skip to content

Commit

Permalink
reduce code with array desctructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
dmstern committed Nov 26, 2018
1 parent 635a66e commit 09262b9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions types/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,13 @@ export default class Package extends Searchable implements PackageMetaDataDTO {
}

public getSearchItemText(): string[] {
let crafterTexts: string[] = [];
for (const crafter of this.crafters) {
crafterTexts = crafterTexts.concat(crafter.getSearchItemText());
}
return [
this.name || '',
this.description || '',
this.author ? this.author.toString() : '',
]
.concat(this.keywords || []) // TODO: use Tag object instead.
.concat(crafterTexts);
.concat(...this.crafters.map((crafter) => crafter.getSearchItemText()));
}

public get crafters(): Crafter[] {
Expand Down

0 comments on commit 09262b9

Please sign in to comment.