Skip to content

Commit

Permalink
#8 Use new private keyword in TS
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Strittmatter <[email protected]>
  • Loading branch information
Weltraumschaf committed Jun 1, 2022
1 parent d831846 commit 3d5b2eb
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ type sortArg = keyof IAchievableSkill;
@Pipe({ name: 'achievableSkillSort' })
export class AchievableSkillSortPipe implements PipeTransform {
transform(skills: IAchievableSkill[], sortProperty: sortArg): IAchievableSkill[] {
const sortPropertyNullSafe = this._defaultString(sortProperty);
const sortPropertyNullSafe = this.defaultString(sortProperty);
const reverse = ['score', 'rateCount'].includes(sortPropertyNullSafe) ? -1 : 1;
return Array.from(skills).sort(
(skill1, skill2) => reverse * this._defaultString(skill1[sortProperty]).localeCompare(this._defaultString(skill2[sortProperty]))
(skill1, skill2) => reverse * this.defaultString(skill1[sortProperty]).localeCompare(this.defaultString(skill2[sortProperty]))
);
}

_defaultString(smth: any): string {
private defaultString(smth: any): string {
return smth || smth === 0 ? String(smth) : String();
}
}

0 comments on commit 3d5b2eb

Please sign in to comment.