import { Pipe} from '@angular/core';

@Pipe({
  name: "phone"
})
export class PhonePipe {
  transform(number: string) {
    let newStr = "";
    let i = 0;
    for (; i < Math.floor(number.length / 3) - 1; i++) {
      newStr = newStr + number.substr(i * 3, 3) + " ";
    }
    return newStr + number.substr(i * 3);
  }
}