clabe-validator 1.7.3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,7 @@ _JavaScript library to analyze or create a CLABE number for a Mexican bank accou
7
7
  [![npm](https://img.shields.io/npm/v/clabe-validator.svg)](https://www.npmjs.com/package/clabe-validator)
8
8
  [![Vulnerabilities](https://snyk.io/test/github/center-key/clabe-validator/badge.svg)](https://snyk.io/test/github/center-key/clabe-validator)
9
9
  [![Hits](https://data.jsdelivr.com/v1/package/npm/clabe-validator/badge?style=rounded)](https://www.jsdelivr.com/package/npm/clabe-validator)
10
- [![Build](https://github.com/center-key/clabe-validator/workflows/build/badge.svg)](https://github.com/center-key/clabe-validator/actions?query=workflow%3Abuild)
10
+ [![Build](https://github.com/center-key/clabe-validator/workflows/build/badge.svg)](https://github.com/center-key/clabe-validator/actions/workflows/run-spec-on-push.yaml)
11
11
 
12
12
  CLABE (Clave Bancaria Estandarizada — Spanish for "standardized banking code") is a banking
13
13
  standard from the Mexican Bank Association (Asociación de Bancos de México — ABM) for
@@ -26,7 +26,7 @@ Include in a web page:
26
26
  ```
27
27
  or from the [jsdelivr.com CDN](https://www.jsdelivr.com/package/npm/clabe-validator):
28
28
  ```html
29
- <script src=https://cdn.jsdelivr.net/npm/clabe-validator@1.7/dist/clabe.min.js></script>
29
+ <script src=https://cdn.jsdelivr.net/npm/clabe-validator@2.0/dist/clabe.min.js></script>
30
30
  ```
31
31
  ### Node.js server
32
32
  Install package for node:
@@ -62,8 +62,10 @@ console.log('Your bank: ' + clabeCheck.bank);
62
62
  message: 'Valid',
63
63
  clabe: '002010077777777771',
64
64
  tag: 'BANAMEX',
65
- bank: 'Banco Nacional de México, S.A.',
65
+ bank: 'Banco Nacional de México',
66
66
  city: 'Aguascalientes MX-AGU',
67
+ multiple: false,
68
+ total: 1,
67
69
  account: '07777777777',
68
70
  code: { bank: '002', city: '010' },
69
71
  checksum: 1,
@@ -115,6 +117,8 @@ type ClabeCheck = {
115
117
  tag: string | null, //bank short name, example: 'BANAMEX'
116
118
  bank: string | null, //bank long name, example: 'Banco Nacional'
117
119
  city: string | null, //branch or plaza name
120
+ multiple: boolean, //more than one city share the same code
121
+ total: number, //number of cities
118
122
  account: string, //11-digit zero-padded bank account number
119
123
  code: { bank: string, city: string }, //3-digit codes
120
124
  checksum: number | null, //control digit (0 to 9)
@@ -141,7 +145,8 @@ I was initially unable to transfer funds because the money transfer service repo
141
145
  number I supplied was invalid.&nbsp;
142
146
  Through a little sleuthing and a lot of luck, I discovered that a financial services company had
143
147
  accidentally omitted the very last modulo operation in their CLABE checksum calculation.&nbsp;
144
- The result was that Mexican bank account numbers ending in a zero were rejected.
148
+ The result was that Mexican bank account numbers with certain combinations of digits were
149
+ erroneously rejected.
145
150
 
146
151
  This project was created to fix the checksum bug.&nbsp;
147
152
  It is an open source community project and is not supported by any company.
package/dist/clabe.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- //! clabe-validator v1.7.3 ~~ https://github.com/center-key/clabe-validator ~~ MIT License
1
+ //! clabe-validator v2.0.1 ~~ https://github.com/center-key/clabe-validator ~~ MIT License
2
2
 
3
3
  export declare type ClabeBank = {
4
4
  tag?: string;
@@ -7,9 +7,9 @@ export declare type ClabeBank = {
7
7
  export declare type ClabeBanksMap = {
8
8
  [bankCode: number]: ClabeBank;
9
9
  };
10
- export declare type ClabeCity = [number, string];
10
+ export declare type ClabeCityInfo = [number, string, ClabeMxState?];
11
11
  export declare type ClabeCitiesMap = {
12
- [cityCode: number]: string;
12
+ [cityCode: number]: ClabeCityInfo[];
13
13
  };
14
14
  export declare type ClabeCheck = {
15
15
  ok: boolean;
@@ -20,6 +20,8 @@ export declare type ClabeCheck = {
20
20
  tag: string | null;
21
21
  bank: string | null;
22
22
  city: string | null;
23
+ multiple: boolean;
24
+ total: number;
23
25
  account: string;
24
26
  code: {
25
27
  bank: string;
@@ -27,13 +29,14 @@ export declare type ClabeCheck = {
27
29
  };
28
30
  checksum: number | null;
29
31
  };
32
+ export declare type ClabeMxState = 'MX-AGU' | 'MX-BCN' | 'MX-BCS' | 'MX-CAM' | 'MX-CHH' | 'MX-CHP' | 'MX-CMX' | 'MX-COA' | 'MX-COL' | 'MX-DUR' | 'MX-GRO' | 'MX-GUA' | 'MX-HID' | 'MX-JAL' | 'MX-MEX' | 'MX-MIC' | 'MX-MOR' | 'MX-NAY' | 'MX-NLE' | 'MX-OAX' | 'MX-PUE' | 'MX-QUE' | 'MX-ROO' | 'MX-SIN' | 'MX-SLP' | 'MX-SON' | 'MX-TAB' | 'MX-TAM' | 'MX-TLA' | 'MX-VER' | 'MX-YUC' | 'MX-ZAC';
30
33
  declare const clabe: {
31
34
  version: string;
32
35
  computeChecksum(clabeNum17: string): number | null;
33
36
  validate(clabeNum: string): ClabeCheck;
34
37
  calculate(bankCode: number, cityCode: number, accountNumber: number): string;
35
38
  banksMap: ClabeBanksMap;
36
- cities: ClabeCity[];
39
+ cities: ClabeCityInfo[];
37
40
  citiesMap: ClabeCitiesMap;
38
41
  };
39
42
  export { clabe };