File

projects/i-components/src/lib/pipes/applyconversion.pipe.ts

Description

Pipe for applying a conversion for simple values

Metadata

Name applyConversion
Pure true

Methods

transform
transform(value: any, ...args: any[])
Parameters :
Name Type Optional
value any No
args any[] No
Returns : any
import { Pipe, PipeTransform } from '@angular/core';

/**
 *  Pipe for applying a conversion for simple values
 *
 * @export
 * @class ApplyConversionPurePipe
 * @implements {PipeTransform}
 */
@Pipe({
  name: 'applyConversion',
  pure: true,
})
export class ApplyConversionPurePipe implements PipeTransform {
  transform(value: any, ...args: any[]): any {
    if (typeof args[0] !== 'undefined') {
      return args[0](value);
    } else {
      return value;
    }
  }
}

result-matching ""

    No results matching ""