There is such code:
export default class quickSort { constructor() {} private static partition(mas, l, r) { function swap(mas, a:any, b:any) { let tmp: any = mas[a]; mas[a] = mas[b]; mas[b] = tmp; return mas; } let pos = l-1; for (let i = l; i <= r; ++i) { if (mas[i] <= mas[r] ) mas = swap(mas, ++pos, i); } return pos; } private quick_sort(mas, l, r) { if (l >= r) { return; } let pivot = quickSort.partition(mas,l,r); this.quick_sort(mas,l,pivot-1); this.quick_sort(mas,pivot+1,r); } getSorted(mas, l, r) { this.quick_sort(mas,l,r); return mas; } } but it sorts a simple numeric array. It does not matter that it is a number, it is important that it is not nested. I want to write a method that will sort by a field in an array. Let id