12 lines
422 B
TypeScript
12 lines
422 B
TypeScript
import { Pipe, PipeTransform } from '@angular/core';
|
|
import { SortingService } from './sorting.service';
|
|
import { SortingOrder } from './models/sorting-order.type';
|
|
import { KeysOf } from '../utils';
|
|
|
|
@Pipe({ name: 'sortBy' })
|
|
export class SortByPipe implements PipeTransform {
|
|
transform<T>(values: T[], order: SortingOrder, column: KeysOf<T>): T[] {
|
|
return SortingService.sort(values, order, column);
|
|
}
|
|
}
|