blob: bee24ab116b79b66acb12250fbb57ea082ea4cd5 [file] [log] [blame]
Israel Lavi1994c982018-05-21 17:42:00 +03001import { Pipe, PipeTransform } from '@angular/core';
2import { IDataSchema } from './autocomplete.component';
3
4@Pipe ({
5 name: 'AutocompletePipe',
6})
7export class AutocompletePipe implements PipeTransform {
8 public transform(data: IDataSchema[], text: string) {
9 if (!text || !text.length) {
10 return data;
11 }
12 return data.filter((item: IDataSchema) => {
13 return item.value.toLowerCase().indexOf(text.toLowerCase()) > -1;
14 });
15 }
16}