Created
July 13, 2018 20:42
-
-
Save valterh4ck3r/91940b598dca0e586b1ddcbcf40ac93b to your computer and use it in GitHub Desktop.
Angular Pipe CNPJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Pipe({name: 'cnpj'}) | |
export class CNPJPipe implements PipeTransform { | |
transform(value) { | |
return value.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/g,"\$1.\$2.\$3\/\$4\-\$5") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Valeu