remove-brackets.pipe.ts 384 Bytes
Newer Older
mdsecurity's avatar
mdsecurity committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'removeBrackets'
})
export class RemoveBracketsPipe implements PipeTransform {

  transform(value: string): string {
    console.log(value.substr(0, value.indexOf('[')));
    const index = value.indexOf('[');
    if (index === -1) {
      return value;
    }
    return value.substr(0, value.indexOf('['));
  }

}