in docs-content/examples-source/material/sort/sort-harness/sort-harness-example.ts [23:35]
sortData(sort: Sort) {
const data = this.desserts.slice();
if (!sort.active || sort.direction === '') {
this.sortedData = data;
} else {
this.sortedData = data.sort((a, b) => {
const aValue = (a as any)[sort.active];
const bValue = (b as any)[sort.active];
return (aValue < bValue ? -1 : 1) * (sort.direction === 'asc' ? 1 : -1);
});
}
}