import { Pipe , PipeTransform , NgModule } from '@angular/core' ; import { isArray , getProperty } from '../utils/utils' ; @ Pipe ( { name : 'pluck' , } ) export class PluckPipe implements PipeTransform { transform ( input , key ) { if ( ! isArray ( input ) || ! key ) { return input ; } return input . map ( ( value ) => { return getProperty ( value , key ) ; } ) ; } } @ NgModule ( { declarations : [ PluckPipe ] , exports : [ PluckPipe ] , } ) export class NgPluckPipeModule { }