ibantools 4.3.2 → 4.3.4

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.
@@ -238,7 +238,7 @@ export interface ExtractBICResult {
238
238
  /**
239
239
  * extractBIC
240
240
  * ```
241
- * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: flase, valid: true}
241
+ * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: false, valid: true}
242
242
  * ibantools.extractBIC("ABNANL2A");
243
243
  * ```
244
244
  */
@@ -8,7 +8,7 @@
8
8
  * @package Documentation
9
9
  * @author Saša Jovanić
10
10
  * @module ibantools
11
- * @version 4.3.2
11
+ * @version 4.3.4
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
  * ```
@@ -191,7 +191,7 @@ function isQRIBAN(iban) {
191
191
  if (iban === undefined || iban === null)
192
192
  return false;
193
193
  var countryCode = iban.slice(0, 2);
194
- var QRIBANCountries = ['LX', 'CH'];
194
+ var QRIBANCountries = ['LI', 'CH'];
195
195
  if (!QRIBANCountries.includes(countryCode))
196
196
  return false;
197
197
  var reg = new RegExp('^3[0-1]{1}[0-9]{3}$', '');
@@ -354,7 +354,7 @@ function replaceCharaterWithCode(str) {
354
354
  * @ignore
355
355
  */
356
356
  function mod9710Iban(iban) {
357
- return mod9710(replaceCharaterWithCode(iban.slice(3) + iban.slice(0, 4)));
357
+ return mod9710(replaceCharaterWithCode(iban.slice(4) + iban.slice(0, 4)));
358
358
  }
359
359
  /**
360
360
  * Returns specifications for all countries, even those who are not
@@ -426,7 +426,7 @@ var ValidationErrorsBIC;
426
426
  ValidationErrorsBIC[ValidationErrorsBIC["NoBICProvided"] = 0] = "NoBICProvided";
427
427
  ValidationErrorsBIC[ValidationErrorsBIC["NoBICCountry"] = 1] = "NoBICCountry";
428
428
  ValidationErrorsBIC[ValidationErrorsBIC["WrongBICFormat"] = 2] = "WrongBICFormat";
429
- })(ValidationErrorsBIC = exports.ValidationErrorsBIC || (exports.ValidationErrorsBIC = {}));
429
+ })(ValidationErrorsBIC || (exports.ValidationErrorsBIC = ValidationErrorsBIC = {}));
430
430
  /**
431
431
  * validateBIC
432
432
  * ```
@@ -460,7 +460,7 @@ exports.validateBIC = validateBIC;
460
460
  /**
461
461
  * extractBIC
462
462
  * ```
463
- * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: flase, valid: true}
463
+ * // returns {bankCode: "ABNA", countryCode: "NL", locationCode: "2A", branchCode: null, testBIC: false, valid: true}
464
464
  * ibantools.extractBIC("ABNANL2A");
465
465
  * ```
466
466
  */
@@ -657,31 +657,6 @@ var checkEstonianBBAN = function (bban) {
657
657
  var remainder = sum % 10;
658
658
  return controlDigit === (remainder === 0 ? 0 : 10 - remainder);
659
659
  };
660
- /**
661
- * Finland (FI) BBAN check
662
- *
663
- * @ignore
664
- */
665
- var checkFinlandBBAN = function (bban) {
666
- var weights = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
667
- var controlDigit = parseInt(bban.charAt(13), 10);
668
- var toCheck = bban.substring(0, 13);
669
- var sum = 0;
670
- for (var index = 0; index < toCheck.length; index++) {
671
- if (weights[index] === 1) {
672
- sum += parseInt(toCheck.charAt(index), 10) * weights[index];
673
- }
674
- else {
675
- var value = parseInt(toCheck.charAt(index), 10) * weights[index];
676
- sum += Math.floor(value / 10) + (value % 10);
677
- }
678
- }
679
- var extraSum = sum + controlDigit;
680
- var multiDigit = Math.floor(extraSum / 10);
681
- var result = multiDigit * 10;
682
- var remainder = result - sum;
683
- return remainder === controlDigit;
684
- };
685
660
  /**
686
661
  * Check French (FR) BBAN
687
662
  * Also for Monaco (MC)
@@ -833,7 +808,6 @@ exports.countrySpecs = {
833
808
  AX: {
834
809
  chars: 18,
835
810
  bban_regexp: '^[0-9]{14}$',
836
- bban_validation_func: checkFinlandBBAN,
837
811
  IBANRegistry: true,
838
812
  },
839
813
  AZ: {
@@ -986,12 +960,14 @@ exports.countrySpecs = {
986
960
  FI: {
987
961
  chars: 18,
988
962
  bban_regexp: '^[0-9]{14}$',
989
- bban_validation_func: checkFinlandBBAN,
990
963
  IBANRegistry: true,
991
964
  SEPA: true,
992
965
  },
993
966
  FJ: {},
994
- FK: {},
967
+ FK: {
968
+ chars: 18,
969
+ bban_regexp: '^[A-Z]{2}[0-9]{12}$',
970
+ },
995
971
  FM: {},
996
972
  FO: { chars: 18, bban_regexp: '^[0-9]{14}$', IBANRegistry: true },
997
973
  FR: {
@@ -1272,8 +1248,8 @@ exports.countrySpecs = {
1272
1248
  NF: {},
1273
1249
  NG: {},
1274
1250
  NI: {
1275
- chars: 32,
1276
- bban_regexp: '^[A-Z]{4}[0-9]{24}$',
1251
+ chars: 28,
1252
+ bban_regexp: '^[A-Z]{4}[0-9]{20}$',
1277
1253
  },
1278
1254
  NL: {
1279
1255
  chars: 18,
@@ -1464,7 +1440,7 @@ exports.countrySpecs = {
1464
1440
  US: {},
1465
1441
  UY: {},
1466
1442
  UZ: {},
1467
- VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true },
1443
+ VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true, SEPA: true },
1468
1444
  VC: {},
1469
1445
  VE: {},
1470
1446
  VG: {
@@ -8,7 +8,7 @@
8
8
  * @package Documentation
9
9
  * @author Saša Jovanić
10
10
  * @module ibantools
11
- * @version 4.3.0
11
+ * @version 4.3.4
12
12
  * @license MPL-2.0
13
13
  * @preferred
14
14
  */
@@ -185,7 +185,7 @@ export function isQRIBAN(iban) {
185
185
  if (iban === undefined || iban === null)
186
186
  return false;
187
187
  var countryCode = iban.slice(0, 2);
188
- var QRIBANCountries = ['LX', 'CH'];
188
+ var QRIBANCountries = ['LI', 'CH'];
189
189
  if (!QRIBANCountries.includes(countryCode))
190
190
  return false;
191
191
  var reg = new RegExp('^3[0-1]{1}[0-9]{3}$', '');
@@ -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
  */
@@ -642,31 +642,6 @@ var checkEstonianBBAN = function (bban) {
642
642
  var remainder = sum % 10;
643
643
  return controlDigit === (remainder === 0 ? 0 : 10 - remainder);
644
644
  };
645
- /**
646
- * Finland (FI) BBAN check
647
- *
648
- * @ignore
649
- */
650
- var checkFinlandBBAN = function (bban) {
651
- var weights = [2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
652
- var controlDigit = parseInt(bban.charAt(13), 10);
653
- var toCheck = bban.substring(0, 13);
654
- var sum = 0;
655
- for (var index = 0; index < toCheck.length; index++) {
656
- if (weights[index] === 1) {
657
- sum += parseInt(toCheck.charAt(index), 10) * weights[index];
658
- }
659
- else {
660
- var value = parseInt(toCheck.charAt(index), 10) * weights[index];
661
- sum += Math.floor(value / 10) + (value % 10);
662
- }
663
- }
664
- var extraSum = sum + controlDigit;
665
- var multiDigit = Math.floor(extraSum / 10);
666
- var result = multiDigit * 10;
667
- var remainder = result - sum;
668
- return remainder === controlDigit;
669
- };
670
645
  /**
671
646
  * Check French (FR) BBAN
672
647
  * Also for Monaco (MC)
@@ -817,7 +792,6 @@ export var countrySpecs = {
817
792
  AX: {
818
793
  chars: 18,
819
794
  bban_regexp: '^[0-9]{14}$',
820
- bban_validation_func: checkFinlandBBAN,
821
795
  IBANRegistry: true,
822
796
  },
823
797
  AZ: {
@@ -970,12 +944,14 @@ export var countrySpecs = {
970
944
  FI: {
971
945
  chars: 18,
972
946
  bban_regexp: '^[0-9]{14}$',
973
- bban_validation_func: checkFinlandBBAN,
974
947
  IBANRegistry: true,
975
948
  SEPA: true,
976
949
  },
977
950
  FJ: {},
978
- FK: {},
951
+ FK: {
952
+ chars: 18,
953
+ bban_regexp: '^[A-Z]{2}[0-9]{12}$',
954
+ },
979
955
  FM: {},
980
956
  FO: { chars: 18, bban_regexp: '^[0-9]{14}$', IBANRegistry: true },
981
957
  FR: {
@@ -1256,8 +1232,8 @@ export var countrySpecs = {
1256
1232
  NF: {},
1257
1233
  NG: {},
1258
1234
  NI: {
1259
- chars: 32,
1260
- bban_regexp: '^[A-Z]{4}[0-9]{24}$',
1235
+ chars: 28,
1236
+ bban_regexp: '^[A-Z]{4}[0-9]{20}$',
1261
1237
  },
1262
1238
  NL: {
1263
1239
  chars: 18,
@@ -1346,7 +1322,11 @@ export var countrySpecs = {
1346
1322
  bban_regexp: '^[A-Z]{4}[0-9]{20}[A-Z]{3}$',
1347
1323
  IBANRegistry: true,
1348
1324
  },
1349
- SD: {},
1325
+ SD: {
1326
+ chars: 18,
1327
+ bban_regexp: '^[0-9]{14}$',
1328
+ IBANRegistry: true,
1329
+ },
1350
1330
  SE: { chars: 24, bban_regexp: '^[0-9]{20}$', IBANRegistry: true, SEPA: true },
1351
1331
  SG: {},
1352
1332
  SH: {},
@@ -1376,7 +1356,11 @@ export var countrySpecs = {
1376
1356
  chars: 28,
1377
1357
  bban_regexp: '^[A-Z]{2}[0-9]{22}$',
1378
1358
  },
1379
- SO: {},
1359
+ SO: {
1360
+ chars: 23,
1361
+ bban_regexp: '^[0-9]{19}$',
1362
+ IBANRegistry: true,
1363
+ },
1380
1364
  SR: {},
1381
1365
  SS: {},
1382
1366
  ST: {
@@ -1440,7 +1424,7 @@ export var countrySpecs = {
1440
1424
  US: {},
1441
1425
  UY: {},
1442
1426
  UZ: {},
1443
- VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true },
1427
+ VA: { chars: 22, bban_regexp: '^[0-9]{18}', IBANRegistry: true, SEPA: true },
1444
1428
  VC: {},
1445
1429
  VE: {},
1446
1430
  VG: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibantools",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
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",
@@ -60,9 +60,9 @@
60
60
  "coveralls": "^3.1.1",
61
61
  "docdash": "^2.0.0",
62
62
  "eslint": "^8.0.0",
63
- "eslint-config-prettier": "^8.3.0",
63
+ "eslint-config-prettier": "^9.0.0",
64
64
  "eslint-plugin-prettier": "^4.0.0",
65
- "jasmine-core": "^4.0.0",
65
+ "jasmine-core": "^5.0.0",
66
66
  "karma": "^6.3.4",
67
67
  "karma-chrome-launcher": "^3.1",
68
68
  "karma-jasmine": "^5.0",