Urgent.News

What's breaking now, across thousands of outlets.

Tech

validation-br 2.0: Validation in TypeScript, zero dependencies

Acabei de lançar a versão 2.0 do validation-br , uma biblioteca em TypeScript para validar documentos brasileiros: CPF, CNPJ (numérico e alfanumérico), CEP, Boleto, chave Pix, Pix Copia e Cola, Título de Eleitor, PIS/PASEP, CNH, RENAVAM e mais uma dezena de outros formatos. A grande mudança da 2.0 é a forma como a validação funciona: cada documento agora é uma classe imutável, no estilo value…

Translated from Portuguese Read in Portuguese

The validation-br library, a TypeScript tool for validating Brazilian documents, has been updated to version 2.0. The library supports validation of various documents including CPF, CNPJ, CEP, and others. In version 2.0, each document is now an immutable class, with validation occurring upon instantiation, and throwing an exception if the value is invalid.

The library has no production dependencies and uses native JS/TS APIs. It can be installed via npm and its code is available on GitHub at https://github.com/klawdyo/validation-br.

Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Monday 14 September →