Skip to content

Instantly share code, notes, and snippets.

@valterh4ck3r
Created July 13, 2018 20:42
Show Gist options
  • Save valterh4ck3r/91940b598dca0e586b1ddcbcf40ac93b to your computer and use it in GitHub Desktop.
Save valterh4ck3r/91940b598dca0e586b1ddcbcf40ac93b to your computer and use it in GitHub Desktop.
Angular Pipe CNPJ
@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")
}
}
@brunocicom
Copy link

Tks

@ciirilo
Copy link

ciirilo commented Apr 28, 2022

Brigadão Man!!

@WSlim4
Copy link

WSlim4 commented Aug 28, 2023

Valeu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment