File

packages/ui/src/lib/list/group.pipe.ts

Description

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.

Metadata

Name group

Methods

transform
transform(items: Array>, property: string, value: any)
Parameters :
Name Type Optional
items Array<Item<any>> No
property string No
value any No
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;
    });
  }
}

result-matching ""

    No results matching ""