ibantools 4.3.3 → 4.3.5

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.
@@ -126,12 +126,15 @@ export interface ExtractIBANResult {
126
126
  iban: string;
127
127
  bban?: string;
128
128
  countryCode?: string;
129
+ accountNumber?: string;
130
+ branchIdentifier?: string;
131
+ bankIdentifier?: string;
129
132
  valid: boolean;
130
133
  }
131
134
  /**
132
135
  * extractIBAN
133
136
  * ```
134
- * // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", valid: true}
137
+ * // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", valid: true, accountNumber: '0417164300', bankIdentifier: 'ABNA'}
135
138
  * ibantools.extractIBAN("NL91 ABNA 0417 1643 00");
136
139
  * ```
137
140
  */
@@ -238,7 +241,7 @@ export interface ExtractBICResult {
238
241
  /**
239
242
  * extractBIC
240
243
  * ```
241
- * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: flase, valid: true}
244
+ * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: false, valid: true}
242
245
  * ibantools.extractBIC("ABNANL2A");
243
246
  * ```
244
247
  */
@@ -269,6 +272,9 @@ interface CountrySpecInternal {
269
272
  bban_validation_func?: (bban: string) => boolean;
270
273
  IBANRegistry?: boolean;
271
274
  SEPA?: boolean;
275
+ branch_indentifier?: string;
276
+ bank_identifier?: string;
277
+ account_indentifier?: string;
272
278
  }
273
279
  /**
274
280
  * Interface for Map of Country Specifications
@@ -8,7 +8,7 @@
8
8
  * @package Documentation
9
9
  * @author Saša Jovanić
10
10
  * @module ibantools
11
- * @version 4.3.3
11
+ * @version 4.3.5
12
12
  * @license MPL-2.0
13
13
  * @preferred
14
14
  */
@@ -63,7 +63,7 @@ var ValidationErrorsIBAN;
63
63
  ValidationErrorsIBAN[ValidationErrorsIBAN["WrongIBANChecksum"] = 5] = "WrongIBANChecksum";
64
64
  ValidationErrorsIBAN[ValidationErrorsIBAN["WrongAccountBankBranchChecksum"] = 6] = "WrongAccountBankBranchChecksum";
65
65
  ValidationErrorsIBAN[ValidationErrorsIBAN["QRIBANNotAllowed"] = 7] = "QRIBANNotAllowed";
66
- })(ValidationErrorsIBAN = exports.ValidationErrorsIBAN || (exports.ValidationErrorsIBAN = {}));
66
+ })(ValidationErrorsIBAN || (exports.ValidationErrorsIBAN = ValidationErrorsIBAN = {}));
67
67
  /**
68
68
  * validateIBAN
69
69
  * ```
@@ -229,7 +229,7 @@ exports.composeIBAN = composeIBAN;
229
229
  /**
230
230
  * extractIBAN
231
231
  * ```
232
- * // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", valid: true}
232
+ * // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", valid: true, accountNumber: '0417164300', bankIdentifier: 'ABNA'}
233
233
  * ibantools.extractIBAN("NL91 ABNA 0417 1643 00");
234
234
  * ```
235
235
  */
@@ -241,6 +241,25 @@ function extractIBAN(iban) {
241
241
  result.bban = eFormatIBAN.slice(4);
242
242
  result.countryCode = eFormatIBAN.slice(0, 2);
243
243
  result.valid = true;
244
+ var spec = exports.countrySpecs[result.countryCode];
245
+ if (spec.account_indentifier) {
246
+ var ac = spec.account_indentifier.split('-');
247
+ var starting = parseInt(ac[0]);
248
+ var ending = parseInt(ac[1]);
249
+ result.accountNumber = result.iban.slice(starting, ending + 1);
250
+ }
251
+ if (spec.bank_identifier) {
252
+ var ac = spec.bank_identifier.split('-');
253
+ var starting = parseInt(ac[0]);
254
+ var ending = parseInt(ac[1]);
255
+ result.bankIdentifier = result.bban.slice(starting, ending + 1);
256
+ }
257
+ if (spec.branch_indentifier) {
258
+ var ac = spec.branch_indentifier.split('-');
259
+ var starting = parseInt(ac[0]);
260
+ var ending = parseInt(ac[1]);
261
+ result.branchIdentifier = result.bban.slice(starting, ending + 1);
262
+ }
244
263
  }
245
264
  else {
246
265
  result.valid = false;
@@ -354,7 +373,7 @@ function replaceCharaterWithCode(str) {
354
373
  * @ignore
355
374
  */
356
375
  function mod9710Iban(iban) {
357
- return mod9710(replaceCharaterWithCode(iban.slice(3) + iban.slice(0, 4)));
376
+ return mod9710(replaceCharaterWithCode(iban.slice(4) + iban.slice(0, 4)));
358
377
  }
359
378
  /**
360
379
  * Returns specifications for all countries, even those who are not
@@ -426,7 +445,7 @@ var ValidationErrorsBIC;
426
445
  ValidationErrorsBIC[ValidationErrorsBIC["NoBICProvided"] = 0] = "NoBICProvided";
427
446
  ValidationErrorsBIC[ValidationErrorsBIC["NoBICCountry"] = 1] = "NoBICCountry";
428
447
  ValidationErrorsBIC[ValidationErrorsBIC["WrongBICFormat"] = 2] = "WrongBICFormat";
429
- })(ValidationErrorsBIC = exports.ValidationErrorsBIC || (exports.ValidationErrorsBIC = {}));
448
+ })(ValidationErrorsBIC || (exports.ValidationErrorsBIC = ValidationErrorsBIC = {}));
430
449
  /**
431
450
  * validateBIC
432
451
  * ```
@@ -460,7 +479,7 @@ exports.validateBIC = validateBIC;
460
479
  /**
461
480
  * extractBIC
462
481
  * ```
463
- * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: flase, valid: true}
482
+ * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: false, valid: true}
464
483
  * ibantools.extractBIC("ABNANL2A");
465
484
  * ```
466
485
  */
@@ -780,11 +799,16 @@ exports.countrySpecs = {
780
799
  bban_regexp: '^[0-9]{8}[A-Z0-9]{12}$',
781
800
  IBANRegistry: true,
782
801
  SEPA: true,
802
+ branch_indentifier: '4-7',
803
+ bank_identifier: '0-3',
804
+ account_indentifier: '8-24',
783
805
  },
784
806
  AE: {
785
807
  chars: 23,
786
808
  bban_regexp: '^[0-9]{3}[0-9]{16}$',
787
809
  IBANRegistry: true,
810
+ bank_identifier: '0-2',
811
+ account_indentifier: '7-23',
788
812
  },
789
813
  AF: {},
790
814
  AG: {},
@@ -793,6 +817,9 @@ exports.countrySpecs = {
793
817
  chars: 28,
794
818
  bban_regexp: '^[0-9]{8}[A-Z0-9]{16}$',
795
819
  IBANRegistry: true,
820
+ branch_indentifier: '3-7',
821
+ bank_identifier: '0-2',
822
+ account_indentifier: '12-28',
796
823
  },
797
824
  AM: {},
798
825
  AO: {
@@ -802,7 +829,7 @@ exports.countrySpecs = {
802
829
  AQ: {},
803
830
  AR: {},
804
831
  AS: {},
805
- AT: { chars: 20, bban_regexp: '^[0-9]{16}$', IBANRegistry: true, SEPA: true },
832
+ AT: { chars: 20, bban_regexp: '^[0-9]{16}$', IBANRegistry: true, SEPA: true, bank_identifier: '0-4' },
806
833
  AU: {},
807
834
  AW: {},
808
835
  AX: {
@@ -814,16 +841,28 @@ exports.countrySpecs = {
814
841
  chars: 28,
815
842
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{20}$',
816
843
  IBANRegistry: true,
844
+ bank_identifier: '0-3',
845
+ account_indentifier: '4-28',
817
846
  },
818
847
  BA: {
819
848
  chars: 20,
820
849
  bban_regexp: '^[0-9]{16}$',
821
850
  bban_validation_func: checkMod9710BBAN,
822
851
  IBANRegistry: true,
852
+ branch_indentifier: '3-5',
853
+ bank_identifier: '0-2',
823
854
  },
824
855
  BB: {},
825
856
  BD: {},
826
- BE: { chars: 16, bban_regexp: '^[0-9]{12}$', bban_validation_func: checkBelgianBBAN, IBANRegistry: true, SEPA: true },
857
+ BE: {
858
+ chars: 16,
859
+ bban_regexp: '^[0-9]{12}$',
860
+ bban_validation_func: checkBelgianBBAN,
861
+ IBANRegistry: true,
862
+ SEPA: true,
863
+ bank_identifier: '0-2',
864
+ account_indentifier: '0-16',
865
+ },
827
866
  BF: {
828
867
  chars: 28,
829
868
  bban_regexp: '^[A-Z0-9]{2}[0-9]{22}$',
@@ -833,15 +872,22 @@ exports.countrySpecs = {
833
872
  bban_regexp: '^[A-Z]{4}[0-9]{6}[A-Z0-9]{8}$',
834
873
  IBANRegistry: true,
835
874
  SEPA: true,
875
+ branch_indentifier: '4-7',
876
+ bank_identifier: '0-3',
836
877
  },
837
878
  BH: {
838
879
  chars: 22,
839
880
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{14}$',
840
881
  IBANRegistry: true,
882
+ bank_identifier: '0-3',
883
+ account_indentifier: '8-22',
841
884
  },
842
885
  BI: {
843
886
  chars: 27,
844
887
  bban_regexp: '^[0-9]{23}$',
888
+ branch_indentifier: '5-9',
889
+ bank_identifier: '0-4',
890
+ account_indentifier: '14-27',
845
891
  },
846
892
  BJ: {
847
893
  chars: 28,
@@ -850,7 +896,6 @@ exports.countrySpecs = {
850
896
  BL: {
851
897
  chars: 27,
852
898
  bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$',
853
- IBANRegistry: true,
854
899
  },
855
900
  BM: {},
856
901
  BN: {},
@@ -860,6 +905,9 @@ exports.countrySpecs = {
860
905
  chars: 29,
861
906
  bban_regexp: '^[0-9]{23}[A-Z]{1}[A-Z0-9]{1}$',
862
907
  IBANRegistry: true,
908
+ branch_indentifier: '8-12',
909
+ bank_identifier: '0-7',
910
+ account_indentifier: '17-29',
863
911
  },
864
912
  BS: {},
865
913
  BT: {},
@@ -869,6 +917,7 @@ exports.countrySpecs = {
869
917
  chars: 28,
870
918
  bban_regexp: '^[A-Z]{4}[0-9]{4}[A-Z0-9]{16}$',
871
919
  IBANRegistry: true,
920
+ bank_identifier: '0-3',
872
921
  },
873
922
  BZ: {},
874
923
  CA: {},
@@ -887,6 +936,7 @@ exports.countrySpecs = {
887
936
  bban_regexp: '^[0-9]{5}[A-Z0-9]{12}$',
888
937
  IBANRegistry: true,
889
938
  SEPA: true,
939
+ bank_identifier: '0-4',
890
940
  },
891
941
  CI: {
892
942
  chars: 28,
@@ -904,6 +954,8 @@ exports.countrySpecs = {
904
954
  chars: 22,
905
955
  bban_regexp: '^[0-9]{18}$',
906
956
  IBANRegistry: true,
957
+ bank_identifier: '0-3',
958
+ account_indentifier: '8-22',
907
959
  },
908
960
  CU: {},
909
961
  CV: { chars: 25, bban_regexp: '^[0-9]{21}$' },
@@ -914,6 +966,9 @@ exports.countrySpecs = {
914
966
  bban_regexp: '^[0-9]{8}[A-Z0-9]{16}$',
915
967
  IBANRegistry: true,
916
968
  SEPA: true,
969
+ branch_indentifier: '3-7',
970
+ bank_identifier: '0-2',
971
+ account_indentifier: '12-28',
917
972
  },
918
973
  CZ: {
919
974
  chars: 24,
@@ -921,18 +976,38 @@ exports.countrySpecs = {
921
976
  bban_validation_func: checkCzechAndSlovakBBAN,
922
977
  IBANRegistry: true,
923
978
  SEPA: true,
979
+ bank_identifier: '0-3',
980
+ },
981
+ DE: {
982
+ chars: 22,
983
+ bban_regexp: '^[0-9]{18}$',
984
+ IBANRegistry: true,
985
+ SEPA: true,
986
+ bank_identifier: '0-7',
987
+ account_indentifier: '13-22',
924
988
  },
925
- DE: { chars: 22, bban_regexp: '^[0-9]{18}$', IBANRegistry: true, SEPA: true },
926
989
  DJ: {
927
990
  chars: 27,
928
991
  bban_regexp: '^[0-9]{23}$',
992
+ branch_indentifier: '5-9',
993
+ bank_identifier: '0-4',
994
+ account_indentifier: '14-27',
995
+ },
996
+ DK: {
997
+ chars: 18,
998
+ bban_regexp: '^[0-9]{14}$',
999
+ IBANRegistry: true,
1000
+ SEPA: true,
1001
+ bank_identifier: '0-3',
1002
+ account_indentifier: '4-18',
929
1003
  },
930
- DK: { chars: 18, bban_regexp: '^[0-9]{14}$', IBANRegistry: true, SEPA: true },
931
1004
  DM: {},
932
1005
  DO: {
933
1006
  chars: 28,
934
1007
  bban_regexp: '^[A-Z]{4}[0-9]{20}$',
935
1008
  IBANRegistry: true,
1009
+ bank_identifier: '0-3',
1010
+ account_indentifier: '8-28',
936
1011
  },
937
1012
  DZ: {
938
1013
  chars: 26,
@@ -945,8 +1020,17 @@ exports.countrySpecs = {
945
1020
  bban_validation_func: checkEstonianBBAN,
946
1021
  IBANRegistry: true,
947
1022
  SEPA: true,
1023
+ bank_identifier: '0-1',
1024
+ account_indentifier: '8-20',
1025
+ },
1026
+ EG: {
1027
+ chars: 29,
1028
+ bban_regexp: '^[0-9]{25}',
1029
+ IBANRegistry: true,
1030
+ branch_indentifier: '4-7',
1031
+ bank_identifier: '0-3',
1032
+ account_indentifier: '17-29',
948
1033
  },
949
- EG: { chars: 29, bban_regexp: '^[0-9]{25}', IBANRegistry: true },
950
1034
  EH: {},
951
1035
  ER: {},
952
1036
  ES: {
@@ -955,6 +1039,9 @@ exports.countrySpecs = {
955
1039
  bban_regexp: '^[0-9]{20}$',
956
1040
  IBANRegistry: true,
957
1041
  SEPA: true,
1042
+ branch_indentifier: '4-7',
1043
+ bank_identifier: '0-3',
1044
+ account_indentifier: '4-24',
958
1045
  },
959
1046
  ET: {},
960
1047
  FI: {
@@ -962,17 +1049,32 @@ exports.countrySpecs = {
962
1049
  bban_regexp: '^[0-9]{14}$',
963
1050
  IBANRegistry: true,
964
1051
  SEPA: true,
1052
+ bank_identifier: '0-2',
1053
+ account_indentifier: '0-0',
965
1054
  },
966
1055
  FJ: {},
967
- FK: {},
1056
+ FK: {
1057
+ chars: 18,
1058
+ bban_regexp: '^[A-Z]{2}[0-9]{12}$',
1059
+ bank_identifier: '0-1',
1060
+ account_indentifier: '6-18',
1061
+ },
968
1062
  FM: {},
969
- FO: { chars: 18, bban_regexp: '^[0-9]{14}$', IBANRegistry: true },
1063
+ FO: {
1064
+ chars: 18,
1065
+ bban_regexp: '^[0-9]{14}$',
1066
+ IBANRegistry: true,
1067
+ bank_identifier: '0-3',
1068
+ account_indentifier: '4-18',
1069
+ },
970
1070
  FR: {
971
1071
  chars: 27,
972
1072
  bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$',
973
1073
  bban_validation_func: checkFrenchBBAN,
974
1074
  IBANRegistry: true,
975
1075
  SEPA: true,
1076
+ bank_identifier: '0-4',
1077
+ account_indentifier: '4-27',
976
1078
  },
977
1079
  GA: {
978
1080
  chars: 27,
@@ -983,12 +1085,16 @@ exports.countrySpecs = {
983
1085
  bban_regexp: '^[A-Z]{4}[0-9]{14}$',
984
1086
  IBANRegistry: true,
985
1087
  SEPA: true,
1088
+ branch_indentifier: '4-9',
1089
+ bank_identifier: '0-3',
986
1090
  },
987
1091
  GD: {},
988
1092
  GE: {
989
1093
  chars: 22,
990
1094
  bban_regexp: '^[A-Z0-9]{2}[0-9]{16}$',
991
1095
  IBANRegistry: true,
1096
+ bank_identifier: '0-1',
1097
+ account_indentifier: '6-22',
992
1098
  },
993
1099
  GF: {
994
1100
  chars: 27,
@@ -1002,8 +1108,16 @@ exports.countrySpecs = {
1002
1108
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{15}$',
1003
1109
  IBANRegistry: true,
1004
1110
  SEPA: true,
1111
+ bank_identifier: '0-3',
1112
+ account_indentifier: '8-23',
1113
+ },
1114
+ GL: {
1115
+ chars: 18,
1116
+ bban_regexp: '^[0-9]{14}$',
1117
+ IBANRegistry: true,
1118
+ bank_identifier: '0-3',
1119
+ account_indentifier: '4-18',
1005
1120
  },
1006
- GL: { chars: 18, bban_regexp: '^[0-9]{14}$', IBANRegistry: true },
1007
1121
  GM: {},
1008
1122
  GN: {},
1009
1123
  GP: {
@@ -1020,12 +1134,17 @@ exports.countrySpecs = {
1020
1134
  bban_regexp: '^[0-9]{7}[A-Z0-9]{16}$',
1021
1135
  IBANRegistry: true,
1022
1136
  SEPA: true,
1137
+ branch_indentifier: '3-6',
1138
+ bank_identifier: '0-2',
1139
+ account_indentifier: '7-27',
1023
1140
  },
1024
1141
  GS: {},
1025
1142
  GT: {
1026
1143
  chars: 28,
1027
1144
  bban_regexp: '^[A-Z0-9]{24}$',
1028
1145
  IBANRegistry: true,
1146
+ bank_identifier: '0-3',
1147
+ account_indentifier: '8-28',
1029
1148
  },
1030
1149
  GU: {},
1031
1150
  GW: {
@@ -1045,6 +1164,7 @@ exports.countrySpecs = {
1045
1164
  bban_validation_func: checkCroatianBBAN,
1046
1165
  IBANRegistry: true,
1047
1166
  SEPA: true,
1167
+ bank_identifier: '0-6',
1048
1168
  },
1049
1169
  HT: {},
1050
1170
  HU: {
@@ -1053,6 +1173,8 @@ exports.countrySpecs = {
1053
1173
  bban_validation_func: checkHungarianBBAN,
1054
1174
  IBANRegistry: true,
1055
1175
  SEPA: true,
1176
+ branch_indentifier: '3-6',
1177
+ bank_identifier: '0-2',
1056
1178
  },
1057
1179
  ID: {},
1058
1180
  IE: {
@@ -1060,11 +1182,15 @@ exports.countrySpecs = {
1060
1182
  bban_regexp: '^[A-Z0-9]{4}[0-9]{14}$',
1061
1183
  IBANRegistry: true,
1062
1184
  SEPA: true,
1185
+ branch_indentifier: '4-9',
1186
+ bank_identifier: '0-3',
1063
1187
  },
1064
1188
  IL: {
1065
1189
  chars: 23,
1066
1190
  bban_regexp: '^[0-9]{19}$',
1067
1191
  IBANRegistry: true,
1192
+ branch_indentifier: '3-5',
1193
+ bank_identifier: '0-2',
1068
1194
  },
1069
1195
  IM: {},
1070
1196
  IN: {},
@@ -1073,17 +1199,30 @@ exports.countrySpecs = {
1073
1199
  chars: 23,
1074
1200
  bban_regexp: '^[A-Z]{4}[0-9]{15}$',
1075
1201
  IBANRegistry: true,
1202
+ branch_indentifier: '4-6',
1203
+ bank_identifier: '0-3',
1204
+ account_indentifier: '11-23',
1076
1205
  },
1077
1206
  IR: {
1078
1207
  chars: 26,
1079
1208
  bban_regexp: '^[0-9]{22}$',
1080
1209
  },
1081
- IS: { chars: 26, bban_regexp: '^[0-9]{22}$', IBANRegistry: true, SEPA: true },
1210
+ IS: {
1211
+ chars: 26,
1212
+ bban_regexp: '^[0-9]{22}$',
1213
+ IBANRegistry: true,
1214
+ SEPA: true,
1215
+ branch_indentifier: '2-3',
1216
+ bank_identifier: '0-1',
1217
+ },
1082
1218
  IT: {
1083
1219
  chars: 27,
1084
1220
  bban_regexp: '^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$',
1085
1221
  IBANRegistry: true,
1086
1222
  SEPA: true,
1223
+ branch_indentifier: '6-10',
1224
+ bank_identifier: '1-5',
1225
+ account_indentifier: '4-27',
1087
1226
  },
1088
1227
  JE: {},
1089
1228
  JM: {},
@@ -1091,6 +1230,8 @@ exports.countrySpecs = {
1091
1230
  chars: 30,
1092
1231
  bban_regexp: '^[A-Z]{4}[0-9]{4}[A-Z0-9]{18}$',
1093
1232
  IBANRegistry: true,
1233
+ branch_indentifier: '4-7',
1234
+ bank_identifier: '4-7',
1094
1235
  },
1095
1236
  JP: {},
1096
1237
  KE: {},
@@ -1108,50 +1249,65 @@ exports.countrySpecs = {
1108
1249
  chars: 30,
1109
1250
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{22}$',
1110
1251
  IBANRegistry: true,
1252
+ bank_identifier: '0-3',
1253
+ account_indentifier: '20-30',
1111
1254
  },
1112
1255
  KY: {},
1113
1256
  KZ: {
1114
1257
  chars: 20,
1115
1258
  bban_regexp: '^[0-9]{3}[A-Z0-9]{13}$',
1116
1259
  IBANRegistry: true,
1260
+ bank_identifier: '0-2',
1261
+ account_indentifier: '0-20',
1117
1262
  },
1118
1263
  LA: {},
1119
1264
  LB: {
1120
1265
  chars: 28,
1121
1266
  bban_regexp: '^[0-9]{4}[A-Z0-9]{20}$',
1122
1267
  IBANRegistry: true,
1268
+ bank_identifier: '0-3',
1269
+ account_indentifier: '14-28',
1123
1270
  },
1124
1271
  LC: {
1125
1272
  chars: 32,
1126
1273
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{24}$',
1127
1274
  IBANRegistry: true,
1275
+ bank_identifier: '0-3',
1276
+ account_indentifier: '8-32',
1128
1277
  },
1129
1278
  LI: {
1130
1279
  chars: 21,
1131
1280
  bban_regexp: '^[0-9]{5}[A-Z0-9]{12}$',
1132
1281
  IBANRegistry: true,
1133
1282
  SEPA: true,
1283
+ bank_identifier: '0-4',
1134
1284
  },
1135
1285
  LK: {},
1136
1286
  LR: {},
1137
1287
  LS: {},
1138
- LT: { chars: 20, bban_regexp: '^[0-9]{16}$', IBANRegistry: true, SEPA: true },
1288
+ LT: { chars: 20, bban_regexp: '^[0-9]{16}$', IBANRegistry: true, SEPA: true, bank_identifier: '0-4' },
1139
1289
  LU: {
1140
1290
  chars: 20,
1141
1291
  bban_regexp: '^[0-9]{3}[A-Z0-9]{13}$',
1142
1292
  IBANRegistry: true,
1143
1293
  SEPA: true,
1294
+ bank_identifier: '0-2',
1144
1295
  },
1145
1296
  LV: {
1146
1297
  chars: 21,
1147
1298
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{13}$',
1148
1299
  IBANRegistry: true,
1149
1300
  SEPA: true,
1301
+ bank_identifier: '0-3',
1302
+ account_indentifier: '0-21',
1150
1303
  },
1151
1304
  LY: {
1152
1305
  chars: 25,
1153
1306
  bban_regexp: '^[0-9]{21}$',
1154
1307
  IBANRegistry: true,
1308
+ branch_indentifier: '3-5',
1309
+ bank_identifier: '0-2',
1310
+ account_indentifier: '10-25',
1155
1311
  },
1156
1312
  MA: {
1157
1313
  chars: 28,
@@ -1163,17 +1319,23 @@ exports.countrySpecs = {
1163
1319
  bban_validation_func: checkFrenchBBAN,
1164
1320
  IBANRegistry: true,
1165
1321
  SEPA: true,
1322
+ branch_indentifier: '5-9',
1323
+ bank_identifier: '0-4',
1166
1324
  },
1167
1325
  MD: {
1168
1326
  chars: 24,
1169
1327
  bban_regexp: '^[A-Z0-9]{2}[A-Z0-9]{18}$',
1170
1328
  IBANRegistry: true,
1329
+ bank_identifier: '0-1',
1330
+ account_indentifier: '6-24',
1171
1331
  },
1172
1332
  ME: {
1173
1333
  chars: 22,
1174
1334
  bban_regexp: '^[0-9]{18}$',
1175
1335
  bban_validation_func: checkMod9710BBAN,
1176
1336
  IBANRegistry: true,
1337
+ bank_identifier: '0-2',
1338
+ account_indentifier: '4-22',
1177
1339
  },
1178
1340
  MF: {
1179
1341
  chars: 27,
@@ -1190,6 +1352,7 @@ exports.countrySpecs = {
1190
1352
  bban_regexp: '^[0-9]{3}[A-Z0-9]{10}[0-9]{2}$',
1191
1353
  bban_validation_func: checkMod9710BBAN,
1192
1354
  IBANRegistry: true,
1355
+ bank_identifier: '0-2',
1193
1356
  },
1194
1357
  ML: {
1195
1358
  chars: 28,
@@ -1199,6 +1362,9 @@ exports.countrySpecs = {
1199
1362
  MN: {
1200
1363
  chars: 20,
1201
1364
  bban_regexp: '^[0-9]{16}$',
1365
+ IBANRegistry: true,
1366
+ bank_identifier: '0-3',
1367
+ account_indentifier: '8-20',
1202
1368
  },
1203
1369
  MO: {},
1204
1370
  MP: {},
@@ -1211,6 +1377,9 @@ exports.countrySpecs = {
1211
1377
  chars: 27,
1212
1378
  bban_regexp: '^[0-9]{23}$',
1213
1379
  IBANRegistry: true,
1380
+ branch_indentifier: '5-9',
1381
+ bank_identifier: '0-4',
1382
+ account_indentifier: '4-27',
1214
1383
  },
1215
1384
  MS: {},
1216
1385
  MT: {
@@ -1218,11 +1387,17 @@ exports.countrySpecs = {
1218
1387
  bban_regexp: '^[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$',
1219
1388
  IBANRegistry: true,
1220
1389
  SEPA: true,
1390
+ branch_indentifier: '4-8',
1391
+ bank_identifier: '0-3',
1392
+ account_indentifier: '15-31',
1221
1393
  },
1222
1394
  MU: {
1223
1395
  chars: 30,
1224
1396
  bban_regexp: '^[A-Z]{4}[0-9]{19}[A-Z]{3}$',
1225
1397
  IBANRegistry: true,
1398
+ branch_indentifier: '6-7',
1399
+ bank_identifier: '0-5',
1400
+ account_indentifier: '0-30',
1226
1401
  },
1227
1402
  MV: {},
1228
1403
  MW: {},
@@ -1245,14 +1420,19 @@ exports.countrySpecs = {
1245
1420
  NF: {},
1246
1421
  NG: {},
1247
1422
  NI: {
1248
- chars: 32,
1249
- bban_regexp: '^[A-Z]{4}[0-9]{24}$',
1423
+ chars: 28,
1424
+ bban_regexp: '^[A-Z]{4}[0-9]{20}$',
1425
+ bank_identifier: '0-3',
1426
+ IBANRegistry: true,
1427
+ account_indentifier: '8-28',
1250
1428
  },
1251
1429
  NL: {
1252
1430
  chars: 18,
1253
1431
  bban_regexp: '^[A-Z]{4}[0-9]{10}$',
1254
1432
  IBANRegistry: true,
1255
1433
  SEPA: true,
1434
+ bank_identifier: '0-3',
1435
+ account_indentifier: '8-18',
1256
1436
  },
1257
1437
  NO: {
1258
1438
  chars: 15,
@@ -1260,6 +1440,8 @@ exports.countrySpecs = {
1260
1440
  bban_validation_func: checkNorwayBBAN,
1261
1441
  IBANRegistry: true,
1262
1442
  SEPA: true,
1443
+ bank_identifier: '0-3',
1444
+ account_indentifier: '4-15',
1263
1445
  },
1264
1446
  NP: {},
1265
1447
  NR: {},
@@ -1279,8 +1461,17 @@ exports.countrySpecs = {
1279
1461
  chars: 24,
1280
1462
  bban_regexp: '^[A-Z0-9]{4}[0-9]{16}$',
1281
1463
  IBANRegistry: true,
1464
+ bank_identifier: '0-3',
1465
+ },
1466
+ PL: {
1467
+ chars: 28,
1468
+ bban_validation_func: checkPolandBBAN,
1469
+ bban_regexp: '^[0-9]{24}$',
1470
+ IBANRegistry: true,
1471
+ SEPA: true,
1472
+ branch_indentifier: '0-7',
1473
+ account_indentifier: '2-28',
1282
1474
  },
1283
- PL: { chars: 28, bban_validation_func: checkPolandBBAN, bban_regexp: '^[0-9]{24}$', IBANRegistry: true, SEPA: true },
1284
1475
  PM: {
1285
1476
  chars: 27,
1286
1477
  bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$',
@@ -1292,14 +1483,25 @@ exports.countrySpecs = {
1292
1483
  chars: 29,
1293
1484
  bban_regexp: '^[A-Z0-9]{4}[0-9]{21}$',
1294
1485
  IBANRegistry: true,
1486
+ bank_identifier: '0-3',
1487
+ account_indentifier: '17-29',
1488
+ },
1489
+ PT: {
1490
+ chars: 25,
1491
+ bban_regexp: '^[0-9]{21}$',
1492
+ bban_validation_func: checkMod9710BBAN,
1493
+ IBANRegistry: true,
1494
+ SEPA: true,
1495
+ bank_identifier: '0-3',
1295
1496
  },
1296
- PT: { chars: 25, bban_regexp: '^[0-9]{21}$', bban_validation_func: checkMod9710BBAN, IBANRegistry: true, SEPA: true },
1297
1497
  PW: {},
1298
1498
  PY: {},
1299
1499
  QA: {
1300
1500
  chars: 29,
1301
1501
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{21}$',
1302
1502
  IBANRegistry: true,
1503
+ bank_identifier: '0-3',
1504
+ account_indentifier: '8-29',
1303
1505
  },
1304
1506
  RE: {
1305
1507
  chars: 27,
@@ -1311,36 +1513,49 @@ exports.countrySpecs = {
1311
1513
  bban_regexp: '^[A-Z]{4}[A-Z0-9]{16}$',
1312
1514
  IBANRegistry: true,
1313
1515
  SEPA: true,
1516
+ bank_identifier: '0-3',
1517
+ account_indentifier: '0-24',
1314
1518
  },
1315
1519
  RS: {
1316
1520
  chars: 22,
1317
1521
  bban_regexp: '^[0-9]{18}$',
1318
1522
  bban_validation_func: checkMod9710BBAN,
1319
1523
  IBANRegistry: true,
1524
+ bank_identifier: '0-2',
1320
1525
  },
1321
1526
  RU: {
1322
1527
  chars: 33,
1323
1528
  bban_regexp: '^[0-9]{14}[A-Z0-9]{15}$',
1324
1529
  IBANRegistry: true,
1530
+ branch_indentifier: '9-13',
1531
+ bank_identifier: '0-8',
1532
+ account_indentifier: '13-33',
1325
1533
  },
1326
1534
  RW: {},
1327
1535
  SA: {
1328
1536
  chars: 24,
1329
1537
  bban_regexp: '^[0-9]{2}[A-Z0-9]{18}$',
1330
1538
  IBANRegistry: true,
1539
+ bank_identifier: '0-1',
1540
+ account_indentifier: '12-24',
1331
1541
  },
1332
1542
  SB: {},
1333
1543
  SC: {
1334
1544
  chars: 31,
1335
1545
  bban_regexp: '^[A-Z]{4}[0-9]{20}[A-Z]{3}$',
1336
1546
  IBANRegistry: true,
1547
+ branch_indentifier: '6-7',
1548
+ bank_identifier: '0-5',
1549
+ account_indentifier: '12-28',
1337
1550
  },
1338
1551
  SD: {
1339
1552
  chars: 18,
1340
1553
  bban_regexp: '^[0-9]{14}$',
1341
1554
  IBANRegistry: true,
1555
+ bank_identifier: '0-1',
1556
+ account_indentifier: '6-18',
1342
1557
  },
1343
- SE: { chars: 24, bban_regexp: '^[0-9]{20}$', IBANRegistry: true, SEPA: true },
1558
+ SE: { chars: 24, bban_regexp: '^[0-9]{20}$', IBANRegistry: true, SEPA: true, bank_identifier: '0-2' },
1344
1559
  SG: {},
1345
1560
  SH: {},
1346
1561
  SI: {
@@ -1349,6 +1564,8 @@ exports.countrySpecs = {
1349
1564
  bban_validation_func: checkMod9710BBAN,
1350
1565
  IBANRegistry: true,
1351
1566
  SEPA: true,
1567
+ bank_identifier: '-1-4',
1568
+ account_indentifier: '4-19',
1352
1569
  },
1353
1570
  SJ: {},
1354
1571
  SK: {
@@ -1364,6 +1581,7 @@ exports.countrySpecs = {
1364
1581
  bban_regexp: '^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$',
1365
1582
  IBANRegistry: true,
1366
1583
  SEPA: true,
1584
+ branch_indentifier: '6-10',
1367
1585
  },
1368
1586
  SN: {
1369
1587
  chars: 28,
@@ -1373,6 +1591,8 @@ exports.countrySpecs = {
1373
1591
  chars: 23,
1374
1592
  bban_regexp: '^[0-9]{19}$',
1375
1593
  IBANRegistry: true,
1594
+ branch_indentifier: '4-6',
1595
+ account_indentifier: '11-23',
1376
1596
  },
1377
1597
  SR: {},
1378
1598
  SS: {},
@@ -1380,11 +1600,13 @@ exports.countrySpecs = {
1380
1600
  chars: 25,
1381
1601
  bban_regexp: '^[0-9]{21}$',
1382
1602
  IBANRegistry: true,
1603
+ branch_indentifier: '4-7',
1383
1604
  },
1384
1605
  SV: {
1385
1606
  chars: 28,
1386
1607
  bban_regexp: '^[A-Z]{4}[0-9]{20}$',
1387
1608
  IBANRegistry: true,
1609
+ account_indentifier: '8-28',
1388
1610
  },
1389
1611
  SX: {},
1390
1612
  SY: {},
@@ -1410,12 +1632,15 @@ exports.countrySpecs = {
1410
1632
  chars: 23,
1411
1633
  bban_regexp: '^[0-9]{19}$',
1412
1634
  IBANRegistry: true,
1635
+ account_indentifier: '4-23',
1413
1636
  },
1414
1637
  TM: {},
1415
1638
  TN: {
1416
1639
  chars: 24,
1417
1640
  bban_regexp: '^[0-9]{20}$',
1418
1641
  IBANRegistry: true,
1642
+ branch_indentifier: '2-4',
1643
+ account_indentifier: '4-24',
1419
1644
  },
1420
1645
  TO: {},
1421
1646
  TR: {
@@ -1431,19 +1656,27 @@ exports.countrySpecs = {
1431
1656
  chars: 29,
1432
1657
  bban_regexp: '^[0-9]{6}[A-Z0-9]{19}$',
1433
1658
  IBANRegistry: true,
1659
+ account_indentifier: '15-29',
1434
1660
  },
1435
1661
  UG: {},
1436
1662
  UM: {},
1437
1663
  US: {},
1438
1664
  UY: {},
1439
1665
  UZ: {},
1440
- VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true },
1666
+ VA: {
1667
+ chars: 22,
1668
+ bban_regexp: '^[0-9]{18}',
1669
+ IBANRegistry: true,
1670
+ SEPA: true,
1671
+ account_indentifier: '7-22',
1672
+ },
1441
1673
  VC: {},
1442
1674
  VE: {},
1443
1675
  VG: {
1444
1676
  chars: 24,
1445
1677
  bban_regexp: '^[A-Z0-9]{4}[0-9]{16}$',
1446
1678
  IBANRegistry: true,
1679
+ account_indentifier: '8-24',
1447
1680
  },
1448
1681
  VI: {},
1449
1682
  VN: {},
@@ -1458,6 +1691,8 @@ exports.countrySpecs = {
1458
1691
  chars: 20,
1459
1692
  bban_regexp: '^[0-9]{16}$',
1460
1693
  IBANRegistry: true,
1694
+ branch_indentifier: '2-3',
1695
+ account_indentifier: '4-20',
1461
1696
  },
1462
1697
  YE: {},
1463
1698
  YT: {
@@ -8,7 +8,7 @@
8
8
  * @package Documentation
9
9
  * @author Saša Jovanić
10
10
  * @module ibantools
11
- * @version 4.3.3
11
+ * @version 4.3.4
12
12
  * @license MPL-2.0
13
13
  * @preferred
14
14
  */
@@ -343,7 +343,7 @@ function replaceCharaterWithCode(str) {
343
343
  * @ignore
344
344
  */
345
345
  function mod9710Iban(iban) {
346
- return mod9710(replaceCharaterWithCode(iban.slice(3) + iban.slice(0, 4)));
346
+ return mod9710(replaceCharaterWithCode(iban.slice(4) + iban.slice(0, 4)));
347
347
  }
348
348
  /**
349
349
  * Returns specifications for all countries, even those who are not
@@ -446,7 +446,7 @@ export function validateBIC(bic) {
446
446
  /**
447
447
  * extractBIC
448
448
  * ```
449
- * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: flase, valid: true}
449
+ * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: false, valid: true}
450
450
  * ibantools.extractBIC("ABNANL2A");
451
451
  * ```
452
452
  */
@@ -948,7 +948,10 @@ export var countrySpecs = {
948
948
  SEPA: true,
949
949
  },
950
950
  FJ: {},
951
- FK: {},
951
+ FK: {
952
+ chars: 18,
953
+ bban_regexp: '^[A-Z]{2}[0-9]{12}$',
954
+ },
952
955
  FM: {},
953
956
  FO: { chars: 18, bban_regexp: '^[0-9]{14}$', IBANRegistry: true },
954
957
  FR: {
@@ -1229,8 +1232,8 @@ export var countrySpecs = {
1229
1232
  NF: {},
1230
1233
  NG: {},
1231
1234
  NI: {
1232
- chars: 32,
1233
- bban_regexp: '^[A-Z]{4}[0-9]{24}$',
1235
+ chars: 28,
1236
+ bban_regexp: '^[A-Z]{4}[0-9]{20}$',
1234
1237
  },
1235
1238
  NL: {
1236
1239
  chars: 18,
@@ -1421,7 +1424,7 @@ export var countrySpecs = {
1421
1424
  US: {},
1422
1425
  UY: {},
1423
1426
  UZ: {},
1424
- VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true },
1427
+ VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true, SEPA: true },
1425
1428
  VC: {},
1426
1429
  VE: {},
1427
1430
  VG: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibantools",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
4
4
  "description": "Validation, extraction and creation of IBAN, BBAN, BIC/SWIFT numbers plus some other helpful stuff like ISO 3136-1 alpha 2 country list",
5
5
  "keywords": [
6
6
  "IBAN",
@@ -10,6 +10,7 @@
10
10
  "SWIFT",
11
11
  "ISO 3136-1 alpha-2"
12
12
  ],
13
+ "sideEffects": false,
13
14
  "homepage": "https://github.com/Simplify/ibantools",
14
15
  "bugs": "https://github.com/Simplify/ibantools/issues",
15
16
  "main": "build/ibantools.js",
@@ -42,7 +43,7 @@
42
43
  "build-module": "rm -rf jsnext && npx tsc src/*.ts --target es5 --module es2015 --outDir ./jsnext/",
43
44
  "test": "npm run build && mocha 'test/**/*.js'",
44
45
  "karma": "karma start --single-run",
45
- "coverage": "nyc mocha && nyc report --reporter=text-lcov | coveralls",
46
+ "coverage": "nyc mocha && nyc report --reporter=text-lcov > test.lcov",
46
47
  "lint": "eslint 'src/**/*.ts' 'test/**/*.js'",
47
48
  "prepare": "npm run build-node",
48
49
  "docs": "typedoc src/ibantools.ts",
@@ -54,15 +55,15 @@
54
55
  },
55
56
  "license": "MPL-2.0",
56
57
  "devDependencies": {
57
- "@typescript-eslint/eslint-plugin": "^5.0.0",
58
- "@typescript-eslint/parser": "^5.0.0",
58
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
59
+ "@typescript-eslint/parser": "^6.0.0",
59
60
  "chai": "^4.3.4",
60
- "coveralls": "^3.1.1",
61
+ "coveralls-next": "^4.2.0",
61
62
  "docdash": "^2.0.0",
62
63
  "eslint": "^8.0.0",
63
- "eslint-config-prettier": "^8.3.0",
64
- "eslint-plugin-prettier": "^4.0.0",
65
- "jasmine-core": "^4.0.0",
64
+ "eslint-config-prettier": "^9.0.0",
65
+ "eslint-plugin-prettier": "^5.0.0",
66
+ "jasmine-core": "^5.0.0",
66
67
  "karma": "^6.3.4",
67
68
  "karma-chrome-launcher": "^3.1",
68
69
  "karma-jasmine": "^5.0",
@@ -70,10 +71,10 @@
70
71
  "mocha": "^10.0.0",
71
72
  "mocha-lcov-reporter": "^1.2.0",
72
73
  "nyc": "^15.1.0",
73
- "prettier": "^2.3.2",
74
+ "prettier": "^3.0.3",
74
75
  "requirejs": "^2.3.6",
75
- "typedoc": "^0.24.1",
76
- "typescript": "^5.0.2"
76
+ "typedoc": "^0.25.1",
77
+ "typescript": "^5.2.2"
77
78
  },
78
79
  "resolutions": {
79
80
  "source-map": "^0.8.0-beta.0"