/ng2-brpipes

Angular pipes for BR types

Primary LanguageTypeScriptMIT LicenseMIT

ng2-brpipes

Angular pipes for BR types.

CircleCI

🚨 Breaking changes

The package was updated to Angular v8. The new npm version will start now with v8.0.0 and progress fallowing the framework. If you are using it in legacy do not update to this version, use the legacy v1.2.0.

💾 How to install

npm install ng2-brpipes --save

Or use yarn to prevent broken updated dependencies

yarn add ng2-brpipes

💻 How to Import the Module

There's only a main module, just import it globaly or wherever you want to use it:

import {Ng2BRPipesModule} from 'ng2-brpipes';

@NgModule({
  imports: [Ng2BRPipesModule]
  exports: [Ng2BRPipesModule]
})
export class MyModule { }

📋 Available pipes

RealPipe (NEW)

Transform number to Real currency like format.

{{'9999.99' | real}} // output R$9.999,99

CpfPipe

Transform string in CPF like format.

{{'01964256119' | cpf}} // output 019.642.561-19

CnpjPipe

Transform string in CNPJ like format.

{{'99999999999999' | cnpj}} // output 99.999.999/9999-99

CpfCnpjPipe

Transform string in CPF or CNPJ like format. Accepts both types.

{{'01964256119' | cpfCnpj}} // output 019.642.561-19
{{'99999999999999' | cpfCnpj}} // output 99.999.999/9999-99

CepPipe

Transform string in CEP like format.

{{'72006226' | cep}} // output 72006-226

CeiPipe

Transform string in CEI like format.

{{'761198762985' | cei}} // output 76.119.87629/85

TelefonePipe

Transform string in Telefone like format. Supports 8 and 9 digits phone numbers

{{'3196098689' | telefone}} // output (31)9609-8689

{{'31996098689' | telefone}} // output (31)99609-8689