packages/ui/src/lib/list/group.pipe.ts
The GroupPipe filters an array of Item instances by a given property value. It is meant to be used to get only the items with the exact same value.
Name | group |
transform | ||||||||||||
transform(items: Array
|
||||||||||||
Defined in packages/ui/src/lib/list/group.pipe.ts:10
|
||||||||||||
Parameters :
Returns :
any
|
import { Pipe, PipeTransform } from '@angular/core';
import { Item } from '@ec.components/core';
/** The GroupPipe filters an array of Item instances by a given property value.
* It is meant to be used to get only the items with the exact same value. */
@Pipe({
name: 'group',
})
export class GroupPipe implements PipeTransform {
transform(items: Array<Item<any>>, property: string, value: any): any {
if (!property) {
return items;
}
return items.filter((item) => {
return item.group(property) === value;
});
}
}