import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: "search"
})
export class SearchPipe implements PipeTransform{
    transform(value: any, args?: any): any{
        console.log(value)
        if (!value) return null
        if (!args) return value
        
        args = args.toLowerCase();
        console.log("This is args: ",args)
        const res = value.filter((data: any) => {
            return JSON.stringify(data.info).toLocaleLowerCase().includes(args)
        });
        console.log("This is result: ",res)
        return res;
    }
}