Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (22 sloc) 495 Bytes
import { Pipe, PipeTransform } from '@angular/core';
import { isArray } from '../utils/utils';
@Pipe({
name: 'min'
})
export class MinPipe implements PipeTransform {
transform (input: any): any {
if (!isArray(input)) {
return input;
}
if (input.length === 0) {
return undefined;
}
let min = input[0];
input.forEach((value: any) => {
if (min > value) {
min = value;
}
});
return min;
}
}
You can’t perform that action at this time.