ng2-pipes
Version:
Useful angular2 pipes
13 lines (10 loc) • 330 B
text/typescript
import {PipeTransform, Pipe, Injectable} from '@angular/core';
()
({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);
}
}