All files / lib/dynamic-form-action/dynamic-form-icon dynamic-form-icon.pipe.ts

100% Statements 4/4
100% Branches 2/2
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20          1x 2x                 2x 2x      
import { Pipe, PipeTransform } from '@angular/core';
import { DynamicFormIconTemplate } from './dynamic-form-icon-template';
import { DynamicFormIconService } from './dynamic-form-icon.service';
 
@Pipe({ name: 'dynamicFormIcon' })
export class DynamicFormIconPipe implements PipeTransform {
  constructor(private iconService: DynamicFormIconService) {}
 
  transform(icon: string): string;
  /**
   * @deprecated The method should not be used
   */
  // eslint-disable-next-line @typescript-eslint/unified-signatures
  transform(template: DynamicFormIconTemplate): string;
  transform(iconOrTemplate: string | DynamicFormIconTemplate): string {
    const icon = typeof iconOrTemplate === 'string' ? iconOrTemplate : iconOrTemplate?.icon;
    return this.iconService.getIcon(icon);
  }
}