UNPKG

ng2-pipes

Version:
13 lines (10 loc) 330 B
import {PipeTransform, Pipe, Injectable} from '@angular/core'; @Injectable() @Pipe({name: 'intersection'}) export class IntersectionPipe implements PipeTransform { transform(arr:any[], args:any[] = []):any[] { return args.reduce((newArr, currArr) => newArr.filter(elm => !!~currArr.indexOf(elm)) , arr); } }