Comparing version 4.3.6 to 4.3.7
@@ -11,3 +11,3 @@ /*! | ||
* @module ibantools | ||
* @version 4.3.6 | ||
* @version 4.3.7 | ||
* @license MPL-2.0 | ||
@@ -781,2 +781,33 @@ * @preferred | ||
/** | ||
* Dutch (NL) BBAN check | ||
* | ||
* @ignore | ||
*/ | ||
var checkDutchBBAN = function (bban) { | ||
if (bban === '') { | ||
return false; | ||
} | ||
var weights = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]; | ||
var toCheckAccount = bban.substring(4, 14); | ||
if (toCheckAccount.startsWith('000')) { | ||
return true; | ||
} | ||
if (toCheckAccount.startsWith('00')) { | ||
return false; | ||
} | ||
var sum = toCheckAccount | ||
.split('') | ||
.map(function (value, index) { | ||
if (value === '0' && index === 0) { | ||
return 0; | ||
} | ||
var number = parseInt(value, 10); | ||
var weight = weights[index]; | ||
return number * weight; | ||
}) | ||
.reduce(function (a, b) { return a + b; }); | ||
console.log(sum); | ||
return sum % 11 === 0; | ||
}; | ||
/** | ||
* Set custom BBAN validation function for country. | ||
@@ -1434,2 +1465,3 @@ * | ||
bban_regexp: '^[A-Z]{4}[0-9]{10}$', | ||
bban_validation_func: checkDutchBBAN, | ||
IBANRegistry: true, | ||
@@ -1436,0 +1468,0 @@ SEPA: true, |
{ | ||
"name": "ibantools", | ||
"version": "4.3.6", | ||
"version": "4.3.7", | ||
"description": "Validation, extraction and creation of IBAN, BBAN, BIC/SWIFT numbers plus some other helpful stuff like ISO 3136-1 alpha 2 country list", | ||
@@ -77,3 +77,3 @@ "keywords": [ | ||
"typedoc": "^0.25.1", | ||
"typescript": "^5.2.2" | ||
"typescript": "^5.2" | ||
}, | ||
@@ -80,0 +80,0 @@ "resolutions": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127031
3727