Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
clabe-validator
Advanced tools
Readme
<img src=https://centerkey.com/graphics/center-key-logo.svg align=right width=200 alt=logo>
JavaScript library to analyze or create a CLABE number for a Mexican bank account
CLABE (Clave Bancaria Estandarizada — Spanish for "standardized banking code") is a banking standard from the Mexican Bank Association (Asociación de Bancos de México — ABM) for uniform numbering of bank accounts. CLABE numbers are 18 digits long. See: https://en.wikipedia.org/wiki/CLABE
Try it out:
https://centerkey.com/clabe
Include in a web page:
<script src=clabe.min.js></script>
or from the jsdelivr.com CDN:
<script src=https://cdn.jsdelivr.net/npm/clabe-validator@1.3/dist/clabe.min.js></script>
Install package:
$ npm install clabe-validator
Import package:
const clabe = require('clabe-validator');
Pass the CLABE number as an 18-character string into clabe.validate(clabeNum)
.
const clabeNum = '002010077777777771';
const clabeCheck = clabe.validate(clabeNum);
console.log(clabeCheck.ok ? '¡Que bueno!' : '¡Muy mal!');
console.log('Your bank: ' + clabeCheck.bank);
{
ok: true,
error: null,
formatOk: true,
tag: 'BANAMEX',
bank: 'Banco Nacional de México, S.A.',
city: 'Aguascalientes',
account: '07777777777'
}
{
ok: false,
formatOk: true,
error: 'invalid-city',
message: 'Invalid city code: 000'
}
The formatOk
field indicates if the CLABE's length and checksum are both valid (even if the bank
code or city code are invalid).
Error code | Error message | Format Ok |
---|---|---|
invalid-length | Must be exactly 18 digits long | false |
invalid-characters | Must be only numeric digits (no letters) | false |
invalid-checksum | Invalid checksum, last digit should be: [DIGIT] | false |
invalid-bank | Invalid bank code: [CODE] | true |
invalid-city | Invalid city code: [CODE] | true |
Pass the bank code, city code, and account number into
clabe.calculate(bankCode, cityCode, accountNumber)
and get the 18-character CLABE number back.
const clabeNum = clabe.calculate(2, 10, 7777777777);
console.log(clabeNum === '002010077777777771'); //true
npm install
and npm test
on your
local clone. Make your edits and rerun the tests. Pull requests welcome (no need to
update the version
in package.json or any files in the dist
folder as they are all updated
as part of the release process).CLABE Validator code is open source under the MIT License, and the documentation is published under the CC BY-SA 4.0 license.
FAQs
Analyze or create a CLABE number for a Mexican bank account (written in functional TypeScript)
We found that clabe-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).