import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
  name: 'frameSum'
})
export class FrameSumPipe implements PipeTransform {

  transform(array: any, attr_name: string): any {
    let sum = 0;
    if (array === undefined) {
      return sum;
    }
    for (const s of array) {
      if (s[attr_name] !== undefined) {
        sum += parseInt(s[attr_name], 10);
      }
    }
    return sum;
  }

}
