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

cz-bank-account-validator

v1.0.0

Published

A small and handy library to validate CZ bank account numbers. Running in a browser, in Node.js and also as an ES6 module.

Downloads

75

Readme

Czech Bank Account Validator

A small and handy library to validate CZ bank account numbers. Running in a browser, in Node.js and also as ES6 module.

Getting Started

With npm:

$ npm i --save cz-bank-account-validator

With yarn:

$ yarn add cz-bank-account-validator

Installation

In a browser:

<script type="text/javascript" src="cz-bank-account-validator.min.js"></script>
<script type="text/javascript">
    const bankValidator = window['cz-bank-account-validator'];
    const isValid = bankValidator.validate('2502056361/2010');
    alert(isValid);
</script>

In Node.js (with require):

const bankValidator = require('cz-bank-account-validator/lib/cz-bank-account-validator');

bankValidator.validate('2502056361/2010');
// => true

ES6 Modules:

import bankValidator from 'cz-bank-account-validator/lib/cz-bank-account-validator';

bankValidator.validate('2502056361/2010');
// => true

Usage

const bankValidator = require('cz-bank-account-validator/lib/cz-bank-account-validator');

Valid bank account numbers


bankValidator.validate('2502056361/2010') // true
bankValidator.validate('19-2502056361/0800') // true

Invalid bank account numbers

Unknown bank code (see all supported CZ bank codes):

bankValidator.validate('19-2502056361/9999') // false

Account prefix allowed length exceeded:

bankValidator.validate('1999999-2502056361/0800') // false

Account number mod 11 rule not fulfilled:

bankValidator.validate('19-9144118100/0800') // false

Get all CZ bank codes

bankValidator.getAllBankCodes() // '{"2010":{"bankName":"Fio banka, a.s."},"2020":{"bankName":"MUFG Bank (Europe) N.V. Prague Branch"},"2030":{"bankName":"AKCENTA, spořitelní a úvěrní družstvo"}, ... "0710":{"bankName":"Česká národní banka"},"0800":{"bankName":"Česká spořitelna, a.s."}}'

Get bank account fragments

bankValidator.getAccountPrefix('2502056361/2010') // null - prefix is empty
bankValidator.getAccountPrefix('19-2502056361/0800') // 19
bankValidator.getAccountPrefix('19-2502056361/9999') // null - bank code is invalid => account number is invalid
bankValidator.getAccountPrefix('19-9144118100/0800') // null - account number mod 11 rule not fulfilled => account number is invalid

bankValidator.getAccountNumber('2502056361/2010') // 2502056361
bankValidator.getAccountNumber('19-2502056361/0800') // 2502056361
bankValidator.getAccountNumber('19-2502056361/9999') // null - bank code is invalid => account number is invalid
bankValidator.getAccountNumber('19-9144118100/0800') // null - account number mod 11 rule not fulfilled => account number is invalid

bankValidator.getBankCode('2502056361/2010') // 2010
bankValidator.getBankCode('19-2502056361/0800') // 0800
bankValidator.getBankCode('19-2502056361/9999') // null - bank code is invalid => account number is invalid
bankValidator.getBankCode('19-9144118100/0800') // null - account number mod 11 rule not fulfilled => account number is invalid

License

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