import { Pipe , PipeTransform } from '@angular/core' ; import { orderBy } from 'lodash-es' ; export enum OrderByDirection { Asc = 'asc' , Desc = 'desc' } @ Pipe ( { name : 'mwlOrderBy' } ) export class OrderBy implements PipeTransform { transform ( input , field , direction = OrderByDirection . Asc ) { if ( input && field ) { return orderBy ( input , field , direction ) ; } return input ; } }