
import { Pipe, PipeTransform } from '@angular/core';
import { FragorForAvvikelser } from '@msfa-models/fragor-for-avvikelser.model';

@Pipe({
  name: 'filterFragor',

})
export class FilterFragorPipe implements PipeTransform {
  transform(fragor: FragorForAvvikelser[], id: string): FragorForAvvikelser[] {
    if (fragor?.length === 0) {
      return fragor;
    }

    return fragor?.filter(fraga => fraga?.id.substring(0, 2) === id);
  }
}


