ibantools 4.3.1 → 4.3.3

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.
@@ -8,7 +8,7 @@
8
8
  * @package Documentation
9
9
  * @author Saša Jovanić
10
10
  * @module ibantools
11
- * @version 4.3.1
11
+ * @version 4.3.3
12
12
  * @license MPL-2.0
13
13
  * @preferred
14
14
  */
@@ -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}$', '');
@@ -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,7 +960,6 @@ 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
  },
@@ -1362,7 +1335,11 @@ exports.countrySpecs = {
1362
1335
  bban_regexp: '^[A-Z]{4}[0-9]{20}[A-Z]{3}$',
1363
1336
  IBANRegistry: true,
1364
1337
  },
1365
- SD: {},
1338
+ SD: {
1339
+ chars: 18,
1340
+ bban_regexp: '^[0-9]{14}$',
1341
+ IBANRegistry: true,
1342
+ },
1366
1343
  SE: { chars: 24, bban_regexp: '^[0-9]{20}$', IBANRegistry: true, SEPA: true },
1367
1344
  SG: {},
1368
1345
  SH: {},
@@ -1392,7 +1369,11 @@ exports.countrySpecs = {
1392
1369
  chars: 28,
1393
1370
  bban_regexp: '^[A-Z]{2}[0-9]{22}$',
1394
1371
  },
1395
- SO: {},
1372
+ SO: {
1373
+ chars: 23,
1374
+ bban_regexp: '^[0-9]{19}$',
1375
+ IBANRegistry: true,
1376
+ },
1396
1377
  SR: {},
1397
1378
  SS: {},
1398
1379
  ST: {
@@ -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.3
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}$', '');
@@ -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,7 +944,6 @@ 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
  },
@@ -1346,7 +1319,11 @@ export var countrySpecs = {
1346
1319
  bban_regexp: '^[A-Z]{4}[0-9]{20}[A-Z]{3}$',
1347
1320
  IBANRegistry: true,
1348
1321
  },
1349
- SD: {},
1322
+ SD: {
1323
+ chars: 18,
1324
+ bban_regexp: '^[0-9]{14}$',
1325
+ IBANRegistry: true,
1326
+ },
1350
1327
  SE: { chars: 24, bban_regexp: '^[0-9]{20}$', IBANRegistry: true, SEPA: true },
1351
1328
  SG: {},
1352
1329
  SH: {},
@@ -1376,7 +1353,11 @@ export var countrySpecs = {
1376
1353
  chars: 28,
1377
1354
  bban_regexp: '^[A-Z]{2}[0-9]{22}$',
1378
1355
  },
1379
- SO: {},
1356
+ SO: {
1357
+ chars: 23,
1358
+ bban_regexp: '^[0-9]{19}$',
1359
+ IBANRegistry: true,
1360
+ },
1380
1361
  SR: {},
1381
1362
  SS: {},
1382
1363
  ST: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibantools",
3
- "version": "4.3.1",
3
+ "version": "4.3.3",
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",