summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/pipes/dynamicInputLabel/dynamic-input-label.pipe.ts
blob: f0896befbddc7b33260887598c1a1109b84faacc (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 + ':';
  }
}