aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/pipes/dynamicInputLabel/dynamic-input-label.pipe.ts
blob: bec87b46dbeedbd9bd65a5bcd85ad2c7bf878324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import {PipeTransform, Pipe} from '@angular/core';

@Pipe({ name: 'dynamicInputLabel' })
export class DynamicInputLabelPipe implements PipeTransform {
  transform(text: string): string {
    let split_label = text.toLowerCase().replace(/_/g,' ');
    let uppercase_vnf = split_label.replace(/\bvnf\b/ig, 'VNF');
    let uppercase_nf = uppercase_vnf.replace(/\bnf\b/ig, 'NF');
    let capitalize_sentence = uppercase_nf.charAt(0).toUpperCase() + uppercase_nf.slice(1);
    return capitalize_sentence + ':*';
  }
}