import { Pipe , PipeTransform , NgModule } from '@angular/core' ; import { isArray } from '../utils/utils' ; @ Pipe ( { name : 'head' , } ) export class HeadPipe implements PipeTransform { transform ( input ) { if ( ! isArray ( input ) ) { return input ; } return input [ 0 ] ; } } @ NgModule ( { declarations : [ HeadPipe ] , exports : [ HeadPipe ] , } ) export class NgHeadPipeModule { }