npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

devtoolz-library

v1.3.1

Published

Biblioteca de funcionalidades gerais usadas no dia a dia de um desenvolvedor

Readme

DevToolz Library

Biblioteca TypeScript de utilitários para o dia a dia do desenvolvedor — validação, formatação e geração de documentos brasileiros (CPF, CNPJ), conversores, calculadoras matemáticas e extensões de tipos primitivos.

CNPJ

Formato numérico

import { Cnpj, CnpjValidator, CnpjGenerator, CnpjFormatter } from 'devtoolz-library';

// Validar
const result = new CnpjValidator().validate('11.222.333/0001-81');
result.isValid;  // true
result.message;  // 'Válido'

// Gerar
const gerado = new CnpjGenerator().generate();        // '11222333000181'
const formatado = new CnpjGenerator().generate(true); // '11.222.333/0001-81'

// Value Object
const cnpj = Cnpj.parse('11222333000181');
cnpj.rootDigits;        // '11222333'
cnpj.orderDigits;       // '0001'
cnpj.firstVerifyDigit;  // '8'
cnpj.secondVerifyDigit; // '1'
cnpj.toString();        // '11222333000181'
cnpj.toFormatted();     // '11.222.333/0001-81'

Cnpj.tryParse('invalido'); // null em vez de lançar exceção

Formato alfanumérico (IN RFB nº 2.229/2024 — vigência julho/2026)

A partir de julho de 2026 a Receita Federal passará a emitir CNPJs com letras maiúsculas (A-Z) nas 12 primeiras posições. Os dois dígitos verificadores continuam sempre numéricos.

import { Cnpj, CnpjValidator, CnpjGenerator, CnpjFormatter, CnpjOptions } from 'devtoolz-library';

const opts: CnpjOptions = { format: 'alphanumeric' };

// Validar — o formato é detectado automaticamente quando não informado
const validator = new CnpjValidator();
validator.validate('12.ABC.345/01DE-35');   // isValid = true
validator.validate('12ABC34501DE35', opts); // isValid = true

// Gerar
const generator = new CnpjGenerator();
const raw = generator.generate(opts);                 // ex: 'A1B2C3D4E5F668'
new CnpjFormatter().applyMask(raw);                   // 'A1.B2C.3D4/E5F6-68'

// Value Object
const cnpj = Cnpj.parse('12.ABC.345/01DE-35');
cnpj.rootDigits;        // '12ABC345'
cnpj.orderDigits;       // '01DE'
cnpj.firstVerifyDigit;  // '3'
cnpj.secondVerifyDigit; // '5'
cnpj.toString();        // '12ABC34501DE35'
cnpj.toFormatted();     // '12.ABC.345/01DE-35'

Cnpj.generate({ format: 'alphanumeric' }); // instância de Cnpj alfanumérico

Modo numérico estrito

Passe { format: 'numeric' } para rejeitar qualquer CNPJ com letras:

new CnpjValidator().validate('12ABC34501DE35', { format: 'numeric' });
// isValid = false

CPF

import { Cpf, CpfValidator, CpfGenerator } from 'devtoolz-library';

const cpf = Cpf.parse('123.456.789-09');
new CpfValidator().validate('12345678909').isValid; // true
new CpfGenerator().generate();                      // '12345678909'

Executar testes

npm test