import { Pipe , PipeTransform , NgModule } from '@angular/core' ; import { isArray , isDeepObject , unwrapDeep , deepIndexOf } from '../utils/utils' ; @ Pipe ( { name : 'without' , } ) export class WithoutPipe implements PipeTransform { transform ( input , ... args ) { if ( ! isArray ( input ) && ! isDeepObject ( input ) ) { return input ; } if ( isDeepObject ( input ) ) { const unwrappedInput = unwrapDeep ( input ) ; if ( ! isArray ( unwrappedInput ) ) { return unwrappedInput ; } return unwrappedInput . filter ( ( value ) => deepIndexOf ( args , value ) === - 1 ) ; } return input . filter ( ( value ) => args . indexOf ( value ) === - 1 ) ; } } @ NgModule ( { declarations : [ WithoutPipe ] , exports : [ WithoutPipe ] , } ) export class NgWithoutPipeModule { }