Code Monkey home page Code Monkey logo

clabe-validator's People

Contributors

aespinosa-lj avatar calvinsettachatgul avatar chrishenx avatar deepdivedylan avatar dependabot[bot] avatar dpilafian avatar lalomts avatar linzeur avatar matagbm avatar notunderground avatar nushio avatar shethkushal avatar wejrox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

clabe-validator's Issues

Switch to trailing comma style in spec.js

For multiline arrays and objects, the consistency of including a comma for the last item makes the code easier to edit and helps reduce merge diffs.

See:
https://jshint.com/docs/options/#trailingcomma

For example, change:

const dataSet = [
   { input: '002', expected: 'BANAMEX' },
   { input: '640', expected: 'CB JPMORGAN' },
   { input: '652', expected: 'CREDICAPITAL' }  //no comma
   ];

to:

const dataSet = [
   { input: '002', expected: 'BANAMEX' },
   { input: '640', expected: 'CB JPMORGAN' },
   { input: '652', expected: 'CREDICAPITAL' },  //with comma
   ];

Switch parseInt() with radix 10 to Number()

Apparently there's still a need to support really old js where parseInt() requires the radix parameter to work correctly. See: Issue #14

The cleanest fix is probably just to switch to using Number().

This change requires swapping out all occurrences of parseInt(..., 10) with Number(...).

For example, change:

const checksum = parseInt(clabeNum.substring(17, 18), 10);

to:

const checksum = Number(clabeNum.substring(17, 18));

Run $ npm test to verify all the test cases still pass.

Invalid city code: 969

Hello,

Just wanted to report an error I noticed while trying to validate an NVIO CLABE (e.g. 710969000000000004). I get the error Invalid city code: 969 when I'm sure the clabe is 100% correct and working because it's being used for transfer.

Thanks!

SemVer not compliant package

Hello. @dpilafian

Thank you for the awesome package!

Version 1.5.2 is not compatible with 1.5.1. You published a breaking change as SemVer MINOR.

The main clabe.js 1.5.1 used to have this line:

if (typeof module === "object") module.exports = clabe;

The 1.5.2 does not have it any more. It broke our production builds.

See this line: 6762632#diff-ecf689c52ec37d55479746c939f7e7e13882c8df8848ce65741f8a1e1ad7ae0bL1085

Could you please add back the CommonJS compatibility to the 1.x line?

Thank you

Add Support for bank code 846

846: 'Sistema de Transferencias y Pagos STP',

Hi! I can send a PR if needed but wanted to discuss this first. We've been working with STP, and they have a secondary Bank Code, which I believe they only use for tests. The problem is that they do have "valid clabes" but the CLABE Validator says it's not valid because it starts with 846.

Thoughts? Thanks!

Site appears to be broken

When I enter a number, nothing happens. Unless I'm using this site wrong :)

Javascript console says:
jquery.min.js:2 Uncaught ReferenceError: clabe is not defined
at S.fn.init.setupCalculator ((index):200)
at f (dna.min.js:3)
at f (dna.min.js:3)
at findFn (dna.min.js:3)
at Object.apply (dna.min.js:3)
at run (dna.min.js:3)
at HTMLDivElement. (lib-x.min.js:3)
at Function.each (jquery.min.js:2)
at S.fn.init.each (jquery.min.js:2)
at S.fn.init.forEach (lib-x.min.js:3)

Switch to trailing comma style in spec.js and gulpfile.js

For multiline arrays and objects, the consistency of including a comma for the last item makes the code easier to edit and helps reduce merge diffs.

See:
https://jshint.com/docs/options/#trailingcomma

For example, change:

const dataSet = [
   { input: '002', expected: 'BANAMEX' },
   { input: '640', expected: 'CB JPMORGAN' },
   { input: '652', expected: 'CREDICAPITAL' }  //no comma
   ];

to:

const dataSet = [
   { input: '002', expected: 'BANAMEX' },
   { input: '640', expected: 'CB JPMORGAN' },
   { input: '652', expected: 'CREDICAPITAL' },  //with comma
   ];

Unable to use ir on a React.js project

Hi ✋
I'm trying to use this in my reactjs project to validate de CLABE in the front-end, but when I try tu use it throws the next error:
Unhandled Rejection (TypeError): Cannot read property 'validate' of undefined
I'm trying to use it exactly as the README say.

import { clabe } from "clabe-validator";
----

const clabeNum = "002010077777777771";
const clabeCheck = clabe.validate(clabeNum);
console.log(clabeCheck);

Problem with cities

Hi! This clabe 646521162218542788 is not working because the city is not in the list.

It could be a good idea to allow validation of bank only.

Add new banks from Banco de México's list of institutions

Listado de instituciones:
https://www.banxico.org.mx/cep-scl/listaInstituciones.do

Consider adding the following two missing bank codes:

Clave de la institución code Nombre de la institución
90688 688 CREDICLUB
90703 703 TESORED

List copied from Banco de México website:

const banxicoList = [
   ['40138', 'ABC CAPITAL'],
   ['40133', 'ACTINVER'],
   ['40062', 'AFIRME'],
   ['90661', 'ALTERNATIVOS'],
   ['90706', 'ARCUS'],
   ['90659', 'ASP INTEGRA OPC'],
   ['40128', 'AUTOFIN'],
   ['40127', 'AZTECA'],
   ['37166', 'BaBien'],
   ['40030', 'BAJIO'],
   ['40002', 'BANAMEX'],
   ['40154', 'BANCO COVALTO'],
   ['37006', 'BANCOMEXT'],
   ['40137', 'BANCOPPEL'],
   ['40160', 'BANCO S3'],
   ['40152', 'BANCREA'],
   ['37019', 'BANJERCITO'],
   ['40147', 'BANKAOOL'],
   ['40106', 'BANK OF AMERICA'],
   ['40159', 'BANK OF CHINA'],
   ['37009', 'BANOBRAS'],
   ['40072', 'BANORTE'],
   ['40058', 'BANREGIO'],
   ['40060', 'BANSI'],
   ['02001', 'BANXICO'],
   ['40129', 'BARCLAYS'],
   ['40145', 'BBASE'],
   ['40012', 'BBVA MEXICO'],
   ['40112', 'BMONEX'],
   ['90677', 'CAJA POP MEXICA'],
   ['90683', 'CAJA TELEFONIST'],
   ['90630', 'CB INTERCAM'],
   ['40143', 'CIBANCO'],
   ['90631', 'CI BOLSA'],
   ['90901', 'CLS'],
   ['90903', 'CoDi Valida'],
   ['40130', 'COMPARTAMOS'],
   ['40140', 'CONSUBANCO'],
   ['90652', 'CREDICAPITAL'],
   ['90688', 'CREDICLUB'],
   ['90680', 'CRISTOBAL COLON'],
   ['40151', 'DONDE'],
   ['90616', 'FINAMEX'],
   ['90634', 'FINCOMUN'],
   ['90689', 'FOMPED'],
   ['90685', 'FONDO (FIRA)'],
   ['90601', 'GBM'],
   ['37168', 'HIPOTECARIA FED'],
   ['40021', 'HSBC'],
   ['40155', 'ICBC'],
   ['40036', 'INBURSA'],
   ['90902', 'INDEVAL'],
   ['40150', 'INMOBILIARIO'],
   ['40136', 'INTERCAM BANCO'],
   ['90686', 'INVERCAP'],
   ['40059', 'INVEX'],
   ['40110', 'JP MORGAN'],
   ['90653', 'KUSPIT'],
   ['90670', 'LIBERTAD'],
   ['90602', 'MASARI'],
   ['40042', 'MIFEL'],
   ['40158', 'MIZUHO BANK'],
   ['90600', 'MONEXCB'],
   ['40108', 'MUFG'],
   ['40132', 'MULTIVA BANCO'],
   ['90613', 'MULTIVA CBOLSA'],
   ['37135', 'NAFIN'],
   ['90638', 'NU MEXICO'],
   ['90710', 'NVIO'],
   ['90684', 'OPM'],
   ['40148', 'PAGATODO'],
   ['90620', 'PROFUTURO'],
   ['40156', 'SABADELL'],
   ['40014', 'SANTANDER'],
   ['40044', 'SCOTIABANK'],
   ['40157', 'SHINHAN'],
   ['90646', 'STP'],
   ['90648', 'TACTIV CB'],
   ['90703', 'TESORED'],
   ['90656', 'UNAGRA'],
   ['90617', 'VALMEX'],
   ['90605', 'VALUE'],
   ['90608', 'VECTOR'],
   ['40113', 'VE POR MAS'],
   ['40141', 'VOLKSWAGEN'],
   ];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.