Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (14 sloc) 340 Bytes
import { Pipe, PipeTransform } from '@angular/core';
import { isArray } from '../utils/utils';
@Pipe({
name: 'head'
})
export class HeadPipe implements PipeTransform {
transform (input: any): any {
if (!isArray(input)) {
return input;
}
// Will return undefined if length is 0
return input[0];
}
}
You can’t perform that action at this time.