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 🙏

© 2024 – Pkg Stats / Ryan Hefner

zoop-boleto-brasileiro-validador

v1.3.0

Published

Validador de boletos bancários

Downloads

44

Readme

boleto-brasileiro-validator

Biblioteca para validar boletos.

Suporta boletos de arrecadação e boletos bancários, tanto a representação do código de barras como a linha digitável.

Todas as validações podem ser feitas com ou sem máscara.

Exemplos de boletos

Arrecadação

Represetação visual do código de barras do boleto de arrecadação

Arrecadação - Código de barras

85890000460 52460179160 60759305086 83148300001

Arrecadação - Linha digitável

85890000460-9 52460179160-5 60759305086-5 83148300001-0

Bancário

Represetação visual do código de barras do boleto bancário

Bancário - Código de barras

84890000000404201622018060519042958603411122

Bancário - Linha digitável

23793.38128 60007.827136 95000.063305 9 75520000370000

Instalação

npm install boleto-brasileiro-validator --save

Como usar

Para validar qualquer tipo de boleto, com ou sem máscara

  import { boleto } from 'boleto-brasileiro-validator';

  boleto('23793.38128 60007.827136 95000.063305 9 75520000370000'); // true
  boleto('23793381286000782713695000063305975520000370000'); // true
  boleto('836200000005 667800481000 180975657313 001589636081'); // true
  boleto('536200000005 667800481000 180975657313 001589636081'); // false
  boleto('001933737000000144816060680935031'); // false

Para validar boletos de arrecadação (luz, água, etc.)

  import {
    boletoArrecadacao, // valida qualquer tipo de boleto de arrecadação
    boletoArrecadacaoCodigoBarras, // valida representação númerica do código de barras
    boletoArrecadacaoLinhaDigitavel, // valida linha digitável do boleto
  } from 'boleto-brasileiro-validator';

  boletoArrecadacao('836200000005 667800481000 180975657313 001589636081'); // true
  boletoArrecadacaoCodigoBarras('84890000000404201622018060519042958603411122'); // true
  boletoArrecadacaoLinhaDigitavel('85890000460-9 52460179160-5 60759305086-5 83148300001-0'); // true

Para validar boletos bancários

  import {
    boletoBancario, // valida qualquer tipo de boleto bancário
    boletoBancarioCodigoBarras, // valida representação númerica do código de barras
    boletoBancarioLinhaDigitavel, // valida linha digitável do boleto
  } from 'boleto-brasileiro-validator';

  boletoBancario('23793.38128 60007.827136 95000.063305 9 75520000370000'); // true
  boletoBancarioCodigoBarras('00193373700000001000500940144816060680935031'); // true
  boletoBancarioLinhaDigitavel('23793381286000782713695000063305975520000370000'); // true

Observação

Por padrão, a validação individual de cada bloco não é realizada.

Caso esse comportamento seja necessário, as seguintes funções aceitam um parâmetro adicional para habilitar a validação:

  boleto('23793.38128 60007.827136 95000.063305 9 75520000370000', true);
  boletoBancario('23793381286000782713695000063305975520000370000', true);
  boletoBancarioLinhaDigitavel('23793381286000782713695000063305975520000370000', true);
  boletoArrecadacao('836200000005667800481000180975657313001589636081', true);
  boletoArrecadacaoLinhaDigitavel('836200000005667800481000180975657313001589636081', true);

Regras de Validação

Regras para validação de boletos bancários: Especificações Técnicas para Confecção de Boleto de Cobrança do Banco do Brasil

Regras para validação de boletos de arrecadação: FEBRABAN - “Layout” Padrão de Arrecadação/Recebimento com Utilização do Código de Barras

Licença

This project is licensed under the MIT License - see the LICENSE.md file for details