Comparing version 1.6.0 to 2.0.0
@@ -7,26 +7,9 @@ /*! | ||
/** | ||
* Interface for IBAN Country Specification | ||
*/ | ||
export interface CountrySpec { | ||
chars: number; | ||
name: string; | ||
bban_regexp: string; | ||
} | ||
/** | ||
* Interface for Map of country specifications | ||
*/ | ||
export interface CountryMap { | ||
[code: string]: CountrySpec; | ||
} | ||
/** | ||
* Validate IBAN | ||
* @example | ||
* // returns true | ||
* ibantools.isValidIBAN('NL91 ABNA 0517 1643 00'); | ||
* ibantools.isValidIBAN("NL91ABNA0517164300"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidIBAN('NL91-ABNA-0517-1643-00'); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidIBAN('NL92 ABNA 0517 1643 00'); | ||
* ibantools.isValidIBAN("NL92ABNA0517164300"); | ||
* @alias module:ibantools.isValidIBAN | ||
@@ -41,9 +24,6 @@ * @param {string} IBAN IBAN | ||
* // returns true | ||
* ibantools.isValidBBAN('ABNA 0517 1643 00', 'NL'); | ||
* ibantools.isValidBBAN("ABNA0517164300", "NL"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidBBAN('ABNA0517164300', 'NL'); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBBAN('A7NA 0517 1643 00', 'NL'); | ||
* ibantools.isValidBBAN("A7NA0517164300", "NL"); | ||
* @alias module:ibantools.isValidBBAN | ||
@@ -66,3 +46,3 @@ * @param {string} BBAN BBAN | ||
* // returns NL91ABNA0417164300 | ||
* ibantools.composeIBAN('NL', 'ABNA0417164300'); | ||
* ibantools.composeIBAN("NL", "ABNA0417164300"); | ||
* @alias module:ibantools.composeIBAN | ||
@@ -86,4 +66,4 @@ * @param {ComposeIBANParams} Object {bban: string, countryCode: string} | ||
* @example | ||
* // returns {iban: 'NL91ABNA0417164300', bban: 'ABNA0417164300', countryCode: 'NL', countryName: 'Netherlands', valid: true} | ||
* ibantools.extractIBAN('NL91 ABNA 0417 1643 00'); | ||
* // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", countryName: "Netherlands", valid: true} | ||
* ibantools.extractIBAN("NL91 ABNA 0417 1643 00"); | ||
* @alias module:ibantools.extractIBAN | ||
@@ -98,4 +78,4 @@ * @param {string} IBAN IBAN | ||
* @example | ||
* // returns 'NL91ABNA0417164300' | ||
* ibantools.electronicFormatIBAN('NL91 ABNA 0417 1643 00'); | ||
* // returns "NL91ABNA0417164300" | ||
* ibantools.electronicFormatIBAN("NL91 ABNA 0417 1643 00"); | ||
* @alias module:ibantools.electronicFormatIBAN | ||
@@ -110,10 +90,10 @@ * @param {string} IBAN IBAN | ||
* @example | ||
* // returns 'NL91 ABNA 0417 1643 00' | ||
* ibantools.friendlyFormatIBAN('NL91ABNA0417164300'); | ||
* // returns "NL91 ABNA 0417 1643 00" | ||
* ibantools.friendlyFormatIBAN("NL91ABNA0417164300"); | ||
* @example | ||
* // returns 'NL91-ABNA-0417-1643-00' | ||
* ibantools.friendlyFormatIBAN('NL91ABNA0417164300','-'); | ||
* // returns "NL91-ABNA-0417-1643-00" | ||
* ibantools.friendlyFormatIBAN("NL91ABNA0417164300","-"); | ||
* @alias module:ibantools.friendlyFormatIBAN | ||
* @param {string} IBAN IBAN | ||
* @param {string} separator Not required. Default separator is space ' ' | ||
* @param {string} separator Not required. Default separator is space " " | ||
* @return {string} IBAN Friendly formated IBAN | ||
@@ -124,2 +104,5 @@ */ | ||
* getCountrySpecifications | ||
* Returns specifications for all countries, even those who are not | ||
* members of IBAN registry. `IBANRegistry` field indicates if country | ||
* is member of not. | ||
* @example | ||
@@ -132,12 +115,12 @@ * // Validating IBAN form field after user selects his country | ||
* // </select> | ||
* $('#countries').select(function() { | ||
* $("#countries").select(function() { | ||
* // Find country | ||
* let country = ibantools.getCountrySpecifications()[$(this).val()]; | ||
* // Add country code letters to IBAN form field | ||
* $('input#iban').value($(this).val()); | ||
* // Add new value to 'pattern' attribute to #iban input text field | ||
* $('input#iban').attr('pattern', $(this).val() + '[0-9]{2}' + country.bban_regexp.slice(1).replace('$','')); | ||
* $("input#iban").value($(this).val()); | ||
* // Add new value to "pattern" attribute to #iban input text field | ||
* $("input#iban").attr("pattern", $(this).val() + "[0-9]{2}" + country.bban_regexp.slice(1).replace("$","")); | ||
* }); | ||
* @alias module:ibantools.getCountrySpecifications | ||
* @return {CountryMap} Object [countryCode: string]CountrySpec -> {chars: :number, bban_regexp: string, name: string} | ||
* @return {CountryMap} Object [countryCode: string]CountrySpec -> {chars: :number, bban_regexp: string, name: string, IBANRegistry: boolean} | ||
*/ | ||
@@ -149,12 +132,12 @@ export declare function getCountrySpecifications(): CountryMap; | ||
* // returns true | ||
* ibantools.isValidBIC('ABNANL2A'); | ||
* ibantools.isValidBIC("ABNANL2A"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidBIC('NEDSZAJJXXX'); | ||
* ibantools.isValidBIC("NEDSZAJJXXX"); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBIC('ABN4NL2A'); | ||
* ibantools.isValidBIC("ABN4NL2A"); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBIC('ABNA NL 2A'); | ||
* ibantools.isValidBIC("ABNA NL 2A"); | ||
* @alias module:ibantools.isValidBIC | ||
@@ -171,2 +154,3 @@ * @param {string} BIC BIC | ||
countryCode?: string; | ||
countryName?: string; | ||
locationCode?: string; | ||
@@ -180,8 +164,23 @@ branchCode?: string; | ||
* @example | ||
* // returns {bankCode: 'ABNA', countryCode: 'NL', locationCode: '2A', branchCode: null, testBIC: flase, valid: true} | ||
* ibantools.extractBIC('ABNANL2A'); | ||
* // returns {bankCode: "ABNA", countryCode: "NL", countryName: "Netherlands", locationCode: "2A", branchCode: null, testBIC: flase, valid: true} | ||
* ibantools.extractBIC("ABNANL2A"); | ||
* @alias module:ibantools.extractBIC | ||
* @param {string} BIC BIC | ||
* @return {ExtractBICResult} Object {bancCode: string, countryCode: string, locationCode: string, branchCode: string, testBIC: boolean, valid: boolean} | ||
* @return {ExtractBICResult} Object {bancCode: string, countryCode: string, countryName: string, locationCode: string, branchCode: string, testBIC: boolean, valid: boolean} | ||
*/ | ||
export declare function extractBIC(bic: string): ExtractBICResult; | ||
/** | ||
* Interface for IBAN Country Specification | ||
*/ | ||
export interface CountrySpec { | ||
chars: number; | ||
name: string; | ||
bban_regexp: string; | ||
IBANRegistry: boolean; | ||
} | ||
/** | ||
* Interface for Map of Country Specifications | ||
*/ | ||
export interface CountryMap { | ||
[code: string]: CountrySpec; | ||
} |
@@ -11,3 +11,3 @@ /*! | ||
* @see module:ibantools | ||
* @version 1.6.0 | ||
* @version 2.0.0 | ||
* @license MPL-2.0 | ||
@@ -17,4 +17,2 @@ */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Country specifications | ||
var countrySpecs = {}; | ||
/** | ||
@@ -24,9 +22,6 @@ * Validate IBAN | ||
* // returns true | ||
* ibantools.isValidIBAN('NL91 ABNA 0517 1643 00'); | ||
* ibantools.isValidIBAN("NL91ABNA0517164300"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidIBAN('NL91-ABNA-0517-1643-00'); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidIBAN('NL92 ABNA 0517 1643 00'); | ||
* ibantools.isValidIBAN("NL92ABNA0517164300"); | ||
* @alias module:ibantools.isValidIBAN | ||
@@ -38,8 +33,8 @@ * @param {string} IBAN IBAN | ||
if (iban !== undefined && iban !== null) { | ||
var tmpIban = electronicFormatIBAN(iban); | ||
var spec = countrySpecs[tmpIban.slice(0, 2)]; | ||
var spec = countrySpecs[iban.slice(0, 2)]; | ||
if (spec !== undefined && | ||
spec.chars === tmpIban.length && | ||
checkFormatBBAN(tmpIban.slice(4), spec.bban_regexp) && | ||
mod9710(tmpIban) === 1) { | ||
spec.IBANRegistry && | ||
spec.chars === iban.length && | ||
checkFormatBBAN(iban.slice(4), spec.bban_regexp) && | ||
mod9710(iban) === 1) { | ||
return true; | ||
@@ -55,9 +50,6 @@ } | ||
* // returns true | ||
* ibantools.isValidBBAN('ABNA 0517 1643 00', 'NL'); | ||
* ibantools.isValidBBAN("ABNA0517164300", "NL"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidBBAN('ABNA0517164300', 'NL'); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBBAN('A7NA 0517 1643 00', 'NL'); | ||
* ibantools.isValidBBAN("A7NA0517164300", "NL"); | ||
* @alias module:ibantools.isValidBBAN | ||
@@ -69,9 +61,7 @@ * @param {string} BBAN BBAN | ||
function isValidBBAN(bban, countryCode) { | ||
if (bban !== undefined && bban !== null && | ||
countryCode !== undefined && countryCode !== null) { | ||
var tmpBban = electronicFormatIBAN(bban); | ||
if (bban !== undefined && bban !== null && countryCode !== undefined && countryCode !== null) { | ||
var spec = countrySpecs[countryCode]; | ||
if (spec !== undefined && | ||
spec.chars - 4 === tmpBban.length && | ||
checkFormatBBAN(tmpBban, spec.bban_regexp)) { | ||
spec.chars - 4 === bban.length && | ||
checkFormatBBAN(bban, spec.bban_regexp)) { | ||
return true; | ||
@@ -87,3 +77,3 @@ } | ||
* // returns NL91ABNA0417164300 | ||
* ibantools.composeIBAN('NL', 'ABNA0417164300'); | ||
* ibantools.composeIBAN("NL", "ABNA0417164300"); | ||
* @alias module:ibantools.composeIBAN | ||
@@ -100,4 +90,4 @@ * @param {ComposeIBANParams} Object {bban: string, countryCode: string} | ||
checkFormatBBAN(bban, spec.bban_regexp)) { | ||
var checksom = mod9710(params.countryCode + '00' + bban); | ||
return params.countryCode + ('0' + (98 - checksom)).slice(-2) + bban; | ||
var checksom = mod9710(params.countryCode + "00" + bban); | ||
return params.countryCode + ("0" + (98 - checksom)).slice(-2) + bban; | ||
} | ||
@@ -110,4 +100,4 @@ return null; | ||
* @example | ||
* // returns {iban: 'NL91ABNA0417164300', bban: 'ABNA0417164300', countryCode: 'NL', countryName: 'Netherlands', valid: true} | ||
* ibantools.extractIBAN('NL91 ABNA 0417 1643 00'); | ||
* // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", countryName: "Netherlands", valid: true} | ||
* ibantools.extractIBAN("NL91 ABNA 0417 1643 00"); | ||
* @alias module:ibantools.extractIBAN | ||
@@ -119,3 +109,2 @@ * @param {string} IBAN IBAN | ||
var result = {}; | ||
iban = electronicFormatIBAN(iban); | ||
result.iban = iban; | ||
@@ -142,3 +131,3 @@ if (isValidIBAN(iban)) { | ||
function checkFormatBBAN(bban, bformat) { | ||
var reg = new RegExp(bformat, ''); | ||
var reg = new RegExp(bformat, ""); | ||
return reg.test(bban); | ||
@@ -150,4 +139,4 @@ } | ||
* @example | ||
* // returns 'NL91ABNA0417164300' | ||
* ibantools.electronicFormatIBAN('NL91 ABNA 0417 1643 00'); | ||
* // returns "NL91ABNA0417164300" | ||
* ibantools.electronicFormatIBAN("NL91 ABNA 0417 1643 00"); | ||
* @alias module:ibantools.electronicFormatIBAN | ||
@@ -168,15 +157,15 @@ * @param {string} IBAN IBAN | ||
* @example | ||
* // returns 'NL91 ABNA 0417 1643 00' | ||
* ibantools.friendlyFormatIBAN('NL91ABNA0417164300'); | ||
* // returns "NL91 ABNA 0417 1643 00" | ||
* ibantools.friendlyFormatIBAN("NL91ABNA0417164300"); | ||
* @example | ||
* // returns 'NL91-ABNA-0417-1643-00' | ||
* ibantools.friendlyFormatIBAN('NL91ABNA0417164300','-'); | ||
* // returns "NL91-ABNA-0417-1643-00" | ||
* ibantools.friendlyFormatIBAN("NL91ABNA0417164300","-"); | ||
* @alias module:ibantools.friendlyFormatIBAN | ||
* @param {string} IBAN IBAN | ||
* @param {string} separator Not required. Default separator is space ' ' | ||
* @param {string} separator Not required. Default separator is space " " | ||
* @return {string} IBAN Friendly formated IBAN | ||
*/ | ||
function friendlyFormatIBAN(iban, separator) { | ||
if (typeof separator === 'undefined') { | ||
separator = ' '; | ||
if (typeof separator === "undefined") { | ||
separator = " "; | ||
} | ||
@@ -193,3 +182,3 @@ return electronicFormatIBAN(iban).replace(/(.{4})(?!$)/g, "$1" + separator); | ||
iban = iban.slice(3) + iban.slice(0, 4); | ||
var validationString = ''; | ||
var validationString = ""; | ||
for (var n = 1; n < iban.length; n++) { | ||
@@ -212,2 +201,5 @@ var c = iban.charCodeAt(n); | ||
* getCountrySpecifications | ||
* Returns specifications for all countries, even those who are not | ||
* members of IBAN registry. `IBANRegistry` field indicates if country | ||
* is member of not. | ||
* @example | ||
@@ -220,12 +212,12 @@ * // Validating IBAN form field after user selects his country | ||
* // </select> | ||
* $('#countries').select(function() { | ||
* $("#countries").select(function() { | ||
* // Find country | ||
* let country = ibantools.getCountrySpecifications()[$(this).val()]; | ||
* // Add country code letters to IBAN form field | ||
* $('input#iban').value($(this).val()); | ||
* // Add new value to 'pattern' attribute to #iban input text field | ||
* $('input#iban').attr('pattern', $(this).val() + '[0-9]{2}' + country.bban_regexp.slice(1).replace('$','')); | ||
* $("input#iban").value($(this).val()); | ||
* // Add new value to "pattern" attribute to #iban input text field | ||
* $("input#iban").attr("pattern", $(this).val() + "[0-9]{2}" + country.bban_regexp.slice(1).replace("$","")); | ||
* }); | ||
* @alias module:ibantools.getCountrySpecifications | ||
* @return {CountryMap} Object [countryCode: string]CountrySpec -> {chars: :number, bban_regexp: string, name: string} | ||
* @return {CountryMap} Object [countryCode: string]CountrySpec -> {chars: :number, bban_regexp: string, name: string, IBANRegistry: boolean} | ||
*/ | ||
@@ -240,12 +232,12 @@ function getCountrySpecifications() { | ||
* // returns true | ||
* ibantools.isValidBIC('ABNANL2A'); | ||
* ibantools.isValidBIC("ABNANL2A"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidBIC('NEDSZAJJXXX'); | ||
* ibantools.isValidBIC("NEDSZAJJXXX"); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBIC('ABN4NL2A'); | ||
* ibantools.isValidBIC("ABN4NL2A"); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBIC('ABNA NL 2A'); | ||
* ibantools.isValidBIC("ABNA NL 2A"); | ||
* @alias module:ibantools.isValidBIC | ||
@@ -256,4 +248,5 @@ * @param {string} BIC BIC | ||
function isValidBIC(bic) { | ||
var reg = new RegExp('^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$', ''); | ||
return reg.test(bic); | ||
var reg = new RegExp("^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$", ""); | ||
var spec = countrySpecs[bic.toUpperCase().slice(4, 6)]; | ||
return reg.test(bic) && spec !== undefined; | ||
} | ||
@@ -264,7 +257,7 @@ exports.isValidBIC = isValidBIC; | ||
* @example | ||
* // returns {bankCode: 'ABNA', countryCode: 'NL', locationCode: '2A', branchCode: null, testBIC: flase, valid: true} | ||
* ibantools.extractBIC('ABNANL2A'); | ||
* // returns {bankCode: "ABNA", countryCode: "NL", countryName: "Netherlands", locationCode: "2A", branchCode: null, testBIC: flase, valid: true} | ||
* ibantools.extractBIC("ABNANL2A"); | ||
* @alias module:ibantools.extractBIC | ||
* @param {string} BIC BIC | ||
* @return {ExtractBICResult} Object {bancCode: string, countryCode: string, locationCode: string, branchCode: string, testBIC: boolean, valid: boolean} | ||
* @return {ExtractBICResult} Object {bancCode: string, countryCode: string, countryName: string, locationCode: string, branchCode: string, testBIC: boolean, valid: boolean} | ||
*/ | ||
@@ -276,5 +269,7 @@ function extractBIC(bic) { | ||
result.countryCode = bic.slice(4, 6); | ||
var spec = countrySpecs[result.countryCode]; | ||
result.countryName = spec.name; | ||
result.locationCode = bic.slice(6, 8); | ||
result.testBIC = (result.locationCode[1] == '0' ? true : false); | ||
result.branchCode = (bic.length > 8 ? bic.slice(8) : '619'); | ||
result.testBIC = (result.locationCode[1] === "0" ? true : false); | ||
result.branchCode = (bic.length > 8 ? bic.slice(8) : "619"); | ||
result.valid = true; | ||
@@ -288,100 +283,254 @@ } | ||
exports.extractBIC = extractBIC; | ||
/** | ||
* Fill map of IBAN country specifications | ||
*/ | ||
countrySpecs['AD'] = { chars: 24, bban_regexp: '^[0-9]{8}[A-Z0-9]{12}$', name: 'Andorra' }; | ||
countrySpecs['AE'] = { chars: 23, bban_regexp: '^[0-9]{3}[0-9]{16}$', name: 'United Arab Emirates' }; | ||
countrySpecs['AL'] = { chars: 28, bban_regexp: '^[0-9]{8}[A-Z0-9]{16}$', name: 'Albania' }; | ||
countrySpecs['AT'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Austria' }; | ||
countrySpecs['AZ'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{20}$', name: 'Republic of Azerbaijan' }; | ||
countrySpecs['BA'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Bosnia and Herzegovina' }; | ||
countrySpecs['BE'] = { chars: 16, bban_regexp: '^[0-9]{12}$', name: 'Belgium' }; | ||
countrySpecs['BG'] = { chars: 22, bban_regexp: '^[A-Z]{4}[0-9]{6}[A-Z0-9]{8}$', name: 'Bulgaria' }; | ||
countrySpecs['BH'] = { chars: 22, bban_regexp: '^[A-Z]{4}[A-Z0-9]{14}$', name: 'Bahrain' }; | ||
countrySpecs['BR'] = { chars: 29, bban_regexp: '^[0-9]{23}[A-Z]{1}[A-Z0-9]{1}$', name: 'Brazil' }; | ||
countrySpecs['BY'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{4}[A-Z0-9]{16}$', name: 'Republic of Belarus' }; | ||
countrySpecs['CH'] = { chars: 21, bban_regexp: '^[0-9]{5}[A-Z0-9]{12}$', name: 'Switzerland' }; | ||
countrySpecs['CR'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Costa Rica' }; | ||
countrySpecs['CY'] = { chars: 28, bban_regexp: '^[0-9]{8}[A-Z0-9]{16}$', name: 'Cyprus' }; | ||
countrySpecs['CZ'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Czech Republic' }; | ||
countrySpecs['DE'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Germany' }; | ||
// Denmark | ||
countrySpecs['DK'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Denmark' }; | ||
countrySpecs['FO'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Faroe Islands (Denmark)' }; | ||
countrySpecs['GL'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Greenland (Denmark)' }; | ||
// End Denmark | ||
countrySpecs['DO'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{20}$', name: 'Dominican Republic' }; | ||
countrySpecs['EE'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Estonia' }; | ||
countrySpecs['ES'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Spain' }; | ||
// Finland | ||
countrySpecs['FI'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Finland' }; | ||
countrySpecs['AX'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Aland Islands (Finland)' }; | ||
// End Finland | ||
// France | ||
countrySpecs['FR'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'France' }; | ||
countrySpecs['GF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'French Guyana (France)' }; | ||
countrySpecs['GP'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Guadeloupe (France)' }; | ||
countrySpecs['MQ'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Martinique (France)' }; | ||
countrySpecs['RE'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Reunion (France)' }; | ||
countrySpecs['PF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'French Polynesia (France)' }; | ||
countrySpecs['TF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'French Southern Territories (France)' }; | ||
countrySpecs['YT'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Mayotte (France)' }; | ||
countrySpecs['NC'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'New Caledonia (France)' }; | ||
countrySpecs['BL'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Saint Barthelemy (France)' }; | ||
countrySpecs['MF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Saint Martin (France)' }; | ||
countrySpecs['PM'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Saint Pierre et Miquelon (France)' }; | ||
countrySpecs['WF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Wallis and Futuna Islands (France)' }; | ||
// End France | ||
// United Kingdom | ||
countrySpecs['GB'] = { chars: 22, bban_regexp: '^[A-Z]{4}[0-9]{14}$', name: 'United Kingdom' }; | ||
// End united kingdom | ||
countrySpecs['GE'] = { chars: 22, bban_regexp: '^[A-Z0-9]{2}[0-9]{16}$', name: 'Georgia' }; | ||
countrySpecs['GI'] = { chars: 23, bban_regexp: '^[A-Z]{4}[A-Z0-9]{15}$', name: 'Gibraltar' }; | ||
countrySpecs['GR'] = { chars: 27, bban_regexp: '^[0-9]{7}[A-Z0-9]{16}$', name: 'Greece' }; | ||
countrySpecs['GT'] = { chars: 28, bban_regexp: '^[A-Z0-9]{24}$', name: 'Guatemala' }; | ||
countrySpecs['HR'] = { chars: 21, bban_regexp: '^[0-9]{17}$', name: 'Croatia' }; | ||
countrySpecs['HU'] = { chars: 28, bban_regexp: '^[0-9]{24}$', name: 'Hungary' }; | ||
countrySpecs['IE'] = { chars: 22, bban_regexp: '^[A-Z0-9]{4}[0-9]{14}$', name: 'Republic of Ireland' }; | ||
countrySpecs['IL'] = { chars: 23, bban_regexp: '^[0-9]{19}$', name: 'Israel' }; | ||
countrySpecs['IQ'] = { chars: 23, bban_regexp: '^[A-Z]{4}[0-9]{15}$', name: 'Iraq' }; | ||
countrySpecs['IS'] = { chars: 26, bban_regexp: '^[0-9]{22}$', name: 'Iceland' }; | ||
countrySpecs['IT'] = { chars: 27, bban_regexp: '^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$', name: 'Italy' }; | ||
countrySpecs['JO'] = { chars: 30, bban_regexp: '^[A-Z]{4}[0-9]{4}[A-Z0-9]{18}$', name: 'Jordan' }; | ||
countrySpecs['KW'] = { chars: 30, bban_regexp: '^[A-Z]{4}[A-Z0-9]{22}$', name: 'Kuwait' }; | ||
countrySpecs['KZ'] = { chars: 20, bban_regexp: '^[0-9]{3}[A-Z0-9]{13}$', name: 'Kazakhstan' }; | ||
countrySpecs['LB'] = { chars: 28, bban_regexp: '^[0-9]{4}[A-Z0-9]{20}$', name: 'Lebanon' }; | ||
countrySpecs['LC'] = { chars: 32, bban_regexp: '^[A-Z]{4}[A-Z0-9]{24}$', name: 'Saint Lucia' }; | ||
countrySpecs['LI'] = { chars: 21, bban_regexp: '^[0-9]{5}[A-Z0-9]{12}$', name: 'Liechtenstein' }; | ||
countrySpecs['LT'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Lithuania' }; | ||
countrySpecs['LU'] = { chars: 20, bban_regexp: '^[0-9]{3}[A-Z0-9]{13}$', name: 'Luxembourg' }; | ||
countrySpecs['LV'] = { chars: 21, bban_regexp: '^[A-Z]{4}[A-Z0-9]{13}$', name: 'Latvia' }; | ||
countrySpecs['MC'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Monaco' }; | ||
countrySpecs['MD'] = { chars: 24, bban_regexp: '^[A-Z0-9]{2}[A-Z0-9]{18}$', name: 'Moldova' }; | ||
countrySpecs['ME'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Montenegro' }; | ||
countrySpecs['MK'] = { chars: 19, bban_regexp: '^[0-9]{3}[A-Z0-9]{10}[0-9]{2}$', name: 'Republic of Macedonia' }; | ||
countrySpecs['MR'] = { chars: 27, bban_regexp: '^[0-9]{23}$', name: 'Mauritania' }; | ||
countrySpecs['MT'] = { chars: 31, bban_regexp: '^[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$', name: 'Malta' }; | ||
countrySpecs['MU'] = { chars: 30, bban_regexp: '^[A-Z]{4}[0-9]{19}[A-Z]{3}$', name: 'Mauritius' }; | ||
countrySpecs['NL'] = { chars: 18, bban_regexp: '^[A-Z]{4}[0-9]{10}$', name: 'Netherlands' }; | ||
countrySpecs['NO'] = { chars: 15, bban_regexp: '^[0-9]{11}$', name: 'Norway' }; | ||
countrySpecs['PK'] = { chars: 24, bban_regexp: '^[A-Z0-9]{4}[0-9]{16}$', name: 'Pakistan' }; | ||
countrySpecs['PL'] = { chars: 28, bban_regexp: '^[0-9]{24}$', name: 'Poland' }; | ||
countrySpecs['PS'] = { chars: 29, bban_regexp: '^[A-Z0-9]{4}[0-9]{21}$', name: 'State of Palestine' }; | ||
countrySpecs['PT'] = { chars: 25, bban_regexp: '^[0-9]{21}$', name: 'Portugal' }; | ||
countrySpecs['QA'] = { chars: 29, bban_regexp: '^[A-Z]{4}[A-Z0-9]{21}$', name: 'Qatar' }; | ||
countrySpecs['RO'] = { chars: 24, bban_regexp: '^[A-Z]{4}[A-Z0-9]{16}$', name: 'Romania' }; | ||
countrySpecs['RS'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Serbia' }; | ||
countrySpecs['SA'] = { chars: 24, bban_regexp: '^[0-9]{2}[A-Z0-9]{18}$', name: 'Saudi Arabia' }; | ||
countrySpecs['SC'] = { chars: 31, bban_regexp: '^[[A-Z]{4}[]0-9]{20}[A-Z]{3}$', name: 'Seychelles' }; | ||
countrySpecs['SE'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Sweden' }; | ||
countrySpecs['SI'] = { chars: 19, bban_regexp: '^[0-9]{15}$', name: 'Slovenia' }; | ||
countrySpecs['SK'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Slovak Republic' }; | ||
countrySpecs['SM'] = { chars: 27, bban_regexp: '^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$', name: 'San Marino' }; | ||
countrySpecs['ST'] = { chars: 25, bban_regexp: '^[0-9]{21}$', name: 'Sao Tome And Principe' }; | ||
countrySpecs['SV'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{20}$', name: 'El Salvador' }; | ||
countrySpecs['TL'] = { chars: 23, bban_regexp: '^[0-9]{19}$', name: 'Timor-Leste' }; | ||
countrySpecs['TN'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Tunisia' }; | ||
countrySpecs['TR'] = { chars: 26, bban_regexp: '^[0-9]{5}[A-Z0-9]{17}$', name: 'Turkey' }; | ||
countrySpecs['UA'] = { chars: 29, bban_regexp: '^[0-9]{6}[A-Z0-9]{19}$', name: 'Ukraine' }; | ||
countrySpecs['VG'] = { chars: 24, bban_regexp: '^[A-Z0-9]{4}[0-9]{16}$', name: 'British Virgin Islands' }; | ||
countrySpecs['XK'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Kosovo' }; | ||
// Country specifications | ||
var countrySpecs = { | ||
AD: { chars: 24, bban_regexp: "^[0-9]{8}[A-Z0-9]{12}$", name: "Andorra", IBANRegistry: true }, | ||
AE: { chars: 23, bban_regexp: "^[0-9]{3}[0-9]{16}$", name: "United Arab Emirates", IBANRegistry: true }, | ||
AF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Afganistan" }, | ||
AG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Antigua and Bermuda" }, | ||
AI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Anguilla" }, | ||
AL: { chars: 28, bban_regexp: "^[0-9]{8}[A-Z0-9]{16}$", name: "Albania", IBANRegistry: true }, | ||
AM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Armenia" }, | ||
AO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Angola" }, | ||
AQ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Antartica" }, | ||
AR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Argentina" }, | ||
AS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "American Samoa" }, | ||
AT: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Austria", IBANRegistry: true }, | ||
AU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Australia" }, | ||
AW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Aruba" }, | ||
AX: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Åland Islands", IBANRegistry: true }, | ||
AZ: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{20}$", name: "Republic of Azerbaijan", IBANRegistry: true }, | ||
BA: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Bosnia and Herzegovina", IBANRegistry: true }, | ||
BB: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Barbados" }, | ||
BD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bangladesh" }, | ||
BE: { chars: 16, bban_regexp: "^[0-9]{12}$", name: "Belgium", IBANRegistry: true }, | ||
BF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Burkina Faso" }, | ||
BG: { chars: 22, bban_regexp: "^[A-Z]{4}[0-9]{6}[A-Z0-9]{8}$", name: "Bulgaria", IBANRegistry: true }, | ||
BH: { chars: 22, bban_regexp: "^[A-Z]{4}[A-Z0-9]{14}$", name: "Bahrain", IBANRegistry: true }, | ||
BI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Burundi" }, | ||
BJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Benin" }, | ||
BL: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Saint Barthelemy", IBANRegistry: true }, | ||
BM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bermuda" }, | ||
BN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Brunei Darusslam" }, | ||
BO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bolivia, Plurinational State of" }, | ||
BQ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bonaire, Sint Eustatius and Saba" }, | ||
BR: { chars: 29, bban_regexp: "^[0-9]{23}[A-Z]{1}[A-Z0-9]{1}$", name: "Brazil", IBANRegistry: true }, | ||
BS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bahamas" }, | ||
BT: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bhutan" }, | ||
BV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bouvet Island" }, | ||
BW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Botswana" }, | ||
BY: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{4}[A-Z0-9]{16}$", name: "Republic of Belarus", IBANRegistry: true }, | ||
BZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Belize" }, | ||
CA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Canada" }, | ||
CC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cocos (Keeling) Islands" }, | ||
CD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Congo, the Democratic Republic of the" }, | ||
CF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Central African Republic" }, | ||
CG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Congo" }, | ||
CH: { chars: 21, bban_regexp: "^[0-9]{5}[A-Z0-9]{12}$", name: "Switzerland", IBANRegistry: true }, | ||
CI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Côte d'Ivoire" }, | ||
CK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cook Islands" }, | ||
CL: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Chile" }, | ||
CM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cameroon" }, | ||
CN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "China" }, | ||
CO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Columbia" }, | ||
CR: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Costa Rica", IBANRegistry: true }, | ||
CU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cuba" }, | ||
CV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cabo Verde" }, | ||
CW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Curaçao" }, | ||
CX: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Christmas Island" }, | ||
CY: { chars: 28, bban_regexp: "^[0-9]{8}[A-Z0-9]{16}$", name: "Cyprus", IBANRegistry: true }, | ||
CZ: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Czech Republic", IBANRegistry: true }, | ||
DE: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Germany", IBANRegistry: true }, | ||
DJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Djibouti" }, | ||
DK: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Denmark", IBANRegistry: true }, | ||
DM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Dominica" }, | ||
DO: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{20}$", name: "Dominican Republic", IBANRegistry: true }, | ||
DZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Algeria" }, | ||
EC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Ecuador" }, | ||
EE: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Estonia", IBANRegistry: true }, | ||
EG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Egypt" }, | ||
EH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Western Sahara" }, | ||
ER: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Eritrea" }, | ||
ES: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Spain", IBANRegistry: true }, | ||
ET: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Ethiopia" }, | ||
FI: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Finland", IBANRegistry: true }, | ||
FJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Fiji" }, | ||
FK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Falkland Islands (Malvinas)" }, | ||
FM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Micronesia, Federated States of" }, | ||
FO: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Faroe Islands (Denmark)", IBANRegistry: true }, | ||
FR: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "France", IBANRegistry: true }, | ||
GA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Gabon" }, | ||
GB: { chars: 22, bban_regexp: "^[A-Z]{4}[0-9]{14}$", name: "United Kingdom", IBANRegistry: true }, | ||
GD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Grenada" }, | ||
GE: { chars: 22, bban_regexp: "^[A-Z0-9]{2}[0-9]{16}$", name: "Georgia", IBANRegistry: true }, | ||
GF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "French Guyana", IBANRegistry: true }, | ||
GG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guernsey" }, | ||
GH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Ghana" }, | ||
GI: { chars: 23, bban_regexp: "^[A-Z]{4}[A-Z0-9]{15}$", name: "Gibraltar", IBANRegistry: true }, | ||
GL: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Greenland", IBANRegistry: true }, | ||
GM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Gambia" }, | ||
GN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guinea" }, | ||
GP: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Guadeloupe", IBANRegistry: true }, | ||
GQ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Equatorial Guinea" }, | ||
GR: { chars: 27, bban_regexp: "^[0-9]{7}[A-Z0-9]{16}$", name: "Greece", IBANRegistry: true }, | ||
GS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "South Georgia and the South Sandwitch Islands" }, | ||
GT: { chars: 28, bban_regexp: "^[A-Z0-9]{24}$", name: "Guatemala", IBANRegistry: true }, | ||
GU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guam" }, | ||
GW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guinea-Bissau" }, | ||
GY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guyana" }, | ||
HK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Hong Kong" }, | ||
HM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Heard Island and McDonald Islands" }, | ||
HN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Honduras" }, | ||
HR: { chars: 21, bban_regexp: "^[0-9]{17}$", name: "Croatia", IBANRegistry: true }, | ||
HT: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Haiti" }, | ||
HU: { chars: 28, bban_regexp: "^[0-9]{24}$", name: "Hungary", IBANRegistry: true }, | ||
ID: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Indonesia" }, | ||
IE: { chars: 22, bban_regexp: "^[A-Z0-9]{4}[0-9]{14}$", name: "Republic of Ireland", IBANRegistry: true }, | ||
IL: { chars: 23, bban_regexp: "^[0-9]{19}$", name: "Israel", IBANRegistry: true }, | ||
IM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Isle of Man" }, | ||
IN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "India" }, | ||
IO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "British Indian Ocean Territory" }, | ||
IQ: { chars: 23, bban_regexp: "^[A-Z]{4}[0-9]{15}$", name: "Iraq", IBANRegistry: true }, | ||
IR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Iran, Islamic Republic of" }, | ||
IS: { chars: 26, bban_regexp: "^[0-9]{22}$", name: "Iceland", IBANRegistry: true }, | ||
IT: { chars: 27, bban_regexp: "^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$", name: "Italy", IBANRegistry: true }, | ||
JE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Jersey" }, | ||
JM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Jamaica" }, | ||
JO: { chars: 30, bban_regexp: "^[A-Z]{4}[0-9]{4}[A-Z0-9]{18}$", name: "Jordan", IBANRegistry: true }, | ||
JP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Japan" }, | ||
KE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Kenya" }, | ||
KG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Kyrgyzstan" }, | ||
KH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cambodia" }, | ||
KI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Kiribati" }, | ||
KM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Comoros" }, | ||
KN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Saint Kitts and Nevis" }, | ||
KP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Korea, Domocratic People's Republic of" }, | ||
KR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Korea, Republic of" }, | ||
KW: { chars: 30, bban_regexp: "^[A-Z]{4}[A-Z0-9]{22}$", name: "Kuwait", IBANRegistry: true }, | ||
KY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cayman Islands" }, | ||
KZ: { chars: 20, bban_regexp: "^[0-9]{3}[A-Z0-9]{13}$", name: "Kazakhstan", IBANRegistry: true }, | ||
LA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Lao People's Democratic Republic" }, | ||
LB: { chars: 28, bban_regexp: "^[0-9]{4}[A-Z0-9]{20}$", name: "Lebanon", IBANRegistry: true }, | ||
LC: { chars: 32, bban_regexp: "^[A-Z]{4}[A-Z0-9]{24}$", name: "Saint Lucia", IBANRegistry: true }, | ||
LI: { chars: 21, bban_regexp: "^[0-9]{5}[A-Z0-9]{12}$", name: "Liechtenstein", IBANRegistry: true }, | ||
LK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Sri Lanka" }, | ||
LR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Liberia" }, | ||
LS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Lesotho" }, | ||
LT: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Lithuania", IBANRegistry: true }, | ||
LU: { chars: 20, bban_regexp: "^[0-9]{3}[A-Z0-9]{13}$", name: "Luxembourg", IBANRegistry: true }, | ||
LV: { chars: 21, bban_regexp: "^[A-Z]{4}[A-Z0-9]{13}$", name: "Latvia", IBANRegistry: true }, | ||
LY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Libya" }, | ||
MA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Marocco" }, | ||
MC: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Monaco", IBANRegistry: true }, | ||
MD: { chars: 24, bban_regexp: "^[A-Z0-9]{2}[A-Z0-9]{18}$", name: "Moldova", IBANRegistry: true }, | ||
ME: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Montenegro", IBANRegistry: true }, | ||
MF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Saint Martin", IBANRegistry: true }, | ||
MG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Madagascar" }, | ||
MH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Marshall Islands" }, | ||
MK: { chars: 19, bban_regexp: "^[0-9]{3}[A-Z0-9]{10}[0-9]{2}$", name: "Macedonia, the former Yugoslav Republic of", IBANRegistry: true }, | ||
ML: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mali" }, | ||
MM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Myanman" }, | ||
MN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mongolia" }, | ||
MO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Macao" }, | ||
MP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Northern mariana Islands" }, | ||
MQ: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Martinique", IBANRegistry: true }, | ||
MR: { chars: 27, bban_regexp: "^[0-9]{23}$", name: "Mauritania", IBANRegistry: true }, | ||
MS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Montserrat" }, | ||
MT: { chars: 31, bban_regexp: "^[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$", name: "Malta", IBANRegistry: true }, | ||
MU: { chars: 30, bban_regexp: "^[A-Z]{4}[0-9]{19}[A-Z]{3}$", name: "Mauritius", IBANRegistry: true }, | ||
MV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Maldives" }, | ||
MW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Malawi" }, | ||
MX: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mexico" }, | ||
MY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Malaysia" }, | ||
MZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mozambique" }, | ||
NA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Namibia" }, | ||
NC: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "New Caledonia", IBANRegistry: true }, | ||
NE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Niger" }, | ||
NF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Norfolk Island" }, | ||
NG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nigeria" }, | ||
NI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nicaraqua" }, | ||
NL: { chars: 18, bban_regexp: "^[A-Z]{4}[0-9]{10}$", name: "Netherlands", IBANRegistry: true }, | ||
NO: { chars: 15, bban_regexp: "^[0-9]{11}$", name: "Norway", IBANRegistry: true }, | ||
NP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nepal" }, | ||
NR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nauru" }, | ||
NU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Niue" }, | ||
NZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "New Zealand" }, | ||
OM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Oman" }, | ||
PA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Panama" }, | ||
PE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Peru" }, | ||
PF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "French Polynesia", IBANRegistry: true }, | ||
PG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Papua New Guinea" }, | ||
PH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Philippines" }, | ||
PK: { chars: 24, bban_regexp: "^[A-Z0-9]{4}[0-9]{16}$", name: "Pakistan", IBANRegistry: true }, | ||
PL: { chars: 28, bban_regexp: "^[0-9]{24}$", name: "Poland", IBANRegistry: true }, | ||
PM: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Saint Pierre et Miquelon", IBANRegistry: true }, | ||
PN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Pitcairn" }, | ||
PR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Puerto Rico" }, | ||
PS: { chars: 29, bban_regexp: "^[A-Z0-9]{4}[0-9]{21}$", name: "Palestine, State of", IBANRegistry: true }, | ||
PT: { chars: 25, bban_regexp: "^[0-9]{21}$", name: "Portugal", IBANRegistry: true }, | ||
PW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Palau" }, | ||
PY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Paraguay" }, | ||
QA: { chars: 29, bban_regexp: "^[A-Z]{4}[A-Z0-9]{21}$", name: "Qatar", IBANRegistry: true }, | ||
RE: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Reunion", IBANRegistry: true }, | ||
RO: { chars: 24, bban_regexp: "^[A-Z]{4}[A-Z0-9]{16}$", name: "Romania", IBANRegistry: true }, | ||
RS: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Serbia", IBANRegistry: true }, | ||
RU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Russian Federation" }, | ||
RW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Rwanda" }, | ||
SA: { chars: 24, bban_regexp: "^[0-9]{2}[A-Z0-9]{18}$", name: "Saudi Arabia", IBANRegistry: true }, | ||
SB: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Solomon Islands" }, | ||
SC: { chars: 31, bban_regexp: "^[[A-Z]{4}[]0-9]{20}[A-Z]{3}$", name: "Seychelles", IBANRegistry: true }, | ||
SD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Sudan" }, | ||
SE: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Sweden", IBANRegistry: true }, | ||
SG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Singapore" }, | ||
SH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Saint Helena, Ascension and Tristan da Cunha" }, | ||
SI: { chars: 19, bban_regexp: "^[0-9]{15}$", name: "Slovenia", IBANRegistry: true }, | ||
SJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Svalbard and Jan Mayen" }, | ||
SK: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Slovak Republic", IBANRegistry: true }, | ||
SL: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Siera Leone" }, | ||
SM: { chars: 27, bban_regexp: "^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$", name: "San Marino", IBANRegistry: true }, | ||
SN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Senegal" }, | ||
SO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Somalia" }, | ||
SR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Suriname" }, | ||
SS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "South Sudan" }, | ||
ST: { chars: 25, bban_regexp: "^[0-9]{21}$", name: "Sao Tome And Principe", IBANRegistry: true }, | ||
SV: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{20}$", name: "El Salvador", IBANRegistry: true }, | ||
SX: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Sint Maarten (Dutch part)" }, | ||
SY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Syrian Arab Republic" }, | ||
SZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Swaziland" }, | ||
TC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Turks and Caicos Islands" }, | ||
TD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Chad" }, | ||
TF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "French Southern Territories", IBANRegistry: true }, | ||
TG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Togo" }, | ||
TH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Thailand" }, | ||
TJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tajikistan" }, | ||
TK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tokelau" }, | ||
TL: { chars: 23, bban_regexp: "^[0-9]{19}$", name: "Timor-Leste", IBANRegistry: true }, | ||
TM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Turkmenistan" }, | ||
TN: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Tunisia", IBANRegistry: true }, | ||
TO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tonga" }, | ||
TR: { chars: 26, bban_regexp: "^[0-9]{5}[A-Z0-9]{17}$", name: "Turkey", IBANRegistry: true }, | ||
TT: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Trinidad and Tobago" }, | ||
TV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tuvalu" }, | ||
TW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Taiwan, Province of China" }, | ||
TZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tanzania, United republic of" }, | ||
UA: { chars: 29, bban_regexp: "^[0-9]{6}[A-Z0-9]{19}$", name: "Ukraine", IBANRegistry: true }, | ||
UG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Uganda" }, | ||
UM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "United States Minor Outlying Islands" }, | ||
US: { chars: null, bban_regexp: null, IBANRegistry: false, name: "United States of America" }, | ||
UY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Uruguay" }, | ||
UZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Uzbekistan" }, | ||
VA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Holy See" }, | ||
VC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Saint Vincent and the Granadines" }, | ||
VE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Venezuela, Bolivian Republic of" }, | ||
VG: { chars: 24, bban_regexp: "^[A-Z0-9]{4}[0-9]{16}$", name: "Virgin Islands, British", IBANRegistry: true }, | ||
VI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Virgin Islands, U.S." }, | ||
VN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Viet Nam" }, | ||
VU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Vanautu" }, | ||
WF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Wallis and Futuna", IBANRegistry: true }, | ||
WS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Samoa" }, | ||
XK: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Kosovo", IBANRegistry: true }, | ||
YE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Yemen" }, | ||
YT: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Mayotte", IBANRegistry: true }, | ||
ZA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "South Africa" }, | ||
ZM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Zambia" }, | ||
ZW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Zimbabwe" }, | ||
}; |
@@ -11,8 +11,6 @@ /*! | ||
* @see module:ibantools | ||
* @version 1.6.0 | ||
* @version 2.0.0 | ||
* @license MPL-2.0 | ||
*/ | ||
"use strict"; | ||
// Country specifications | ||
var countrySpecs = {}; | ||
/** | ||
@@ -22,9 +20,6 @@ * Validate IBAN | ||
* // returns true | ||
* ibantools.isValidIBAN('NL91 ABNA 0517 1643 00'); | ||
* ibantools.isValidIBAN("NL91ABNA0517164300"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidIBAN('NL91-ABNA-0517-1643-00'); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidIBAN('NL92 ABNA 0517 1643 00'); | ||
* ibantools.isValidIBAN("NL92ABNA0517164300"); | ||
* @alias module:ibantools.isValidIBAN | ||
@@ -36,8 +31,8 @@ * @param {string} IBAN IBAN | ||
if (iban !== undefined && iban !== null) { | ||
var tmpIban = electronicFormatIBAN(iban); | ||
var spec = countrySpecs[tmpIban.slice(0, 2)]; | ||
var spec = countrySpecs[iban.slice(0, 2)]; | ||
if (spec !== undefined && | ||
spec.chars === tmpIban.length && | ||
checkFormatBBAN(tmpIban.slice(4), spec.bban_regexp) && | ||
mod9710(tmpIban) === 1) { | ||
spec.IBANRegistry && | ||
spec.chars === iban.length && | ||
checkFormatBBAN(iban.slice(4), spec.bban_regexp) && | ||
mod9710(iban) === 1) { | ||
return true; | ||
@@ -52,9 +47,6 @@ } | ||
* // returns true | ||
* ibantools.isValidBBAN('ABNA 0517 1643 00', 'NL'); | ||
* ibantools.isValidBBAN("ABNA0517164300", "NL"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidBBAN('ABNA0517164300', 'NL'); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBBAN('A7NA 0517 1643 00', 'NL'); | ||
* ibantools.isValidBBAN("A7NA0517164300", "NL"); | ||
* @alias module:ibantools.isValidBBAN | ||
@@ -66,9 +58,7 @@ * @param {string} BBAN BBAN | ||
export function isValidBBAN(bban, countryCode) { | ||
if (bban !== undefined && bban !== null && | ||
countryCode !== undefined && countryCode !== null) { | ||
var tmpBban = electronicFormatIBAN(bban); | ||
if (bban !== undefined && bban !== null && countryCode !== undefined && countryCode !== null) { | ||
var spec = countrySpecs[countryCode]; | ||
if (spec !== undefined && | ||
spec.chars - 4 === tmpBban.length && | ||
checkFormatBBAN(tmpBban, spec.bban_regexp)) { | ||
spec.chars - 4 === bban.length && | ||
checkFormatBBAN(bban, spec.bban_regexp)) { | ||
return true; | ||
@@ -83,3 +73,3 @@ } | ||
* // returns NL91ABNA0417164300 | ||
* ibantools.composeIBAN('NL', 'ABNA0417164300'); | ||
* ibantools.composeIBAN("NL", "ABNA0417164300"); | ||
* @alias module:ibantools.composeIBAN | ||
@@ -96,4 +86,4 @@ * @param {ComposeIBANParams} Object {bban: string, countryCode: string} | ||
checkFormatBBAN(bban, spec.bban_regexp)) { | ||
var checksom = mod9710(params.countryCode + '00' + bban); | ||
return params.countryCode + ('0' + (98 - checksom)).slice(-2) + bban; | ||
var checksom = mod9710(params.countryCode + "00" + bban); | ||
return params.countryCode + ("0" + (98 - checksom)).slice(-2) + bban; | ||
} | ||
@@ -105,4 +95,4 @@ return null; | ||
* @example | ||
* // returns {iban: 'NL91ABNA0417164300', bban: 'ABNA0417164300', countryCode: 'NL', countryName: 'Netherlands', valid: true} | ||
* ibantools.extractIBAN('NL91 ABNA 0417 1643 00'); | ||
* // returns {iban: "NL91ABNA0417164300", bban: "ABNA0417164300", countryCode: "NL", countryName: "Netherlands", valid: true} | ||
* ibantools.extractIBAN("NL91 ABNA 0417 1643 00"); | ||
* @alias module:ibantools.extractIBAN | ||
@@ -114,3 +104,2 @@ * @param {string} IBAN IBAN | ||
var result = {}; | ||
iban = electronicFormatIBAN(iban); | ||
result.iban = iban; | ||
@@ -136,3 +125,3 @@ if (isValidIBAN(iban)) { | ||
function checkFormatBBAN(bban, bformat) { | ||
var reg = new RegExp(bformat, ''); | ||
var reg = new RegExp(bformat, ""); | ||
return reg.test(bban); | ||
@@ -144,4 +133,4 @@ } | ||
* @example | ||
* // returns 'NL91ABNA0417164300' | ||
* ibantools.electronicFormatIBAN('NL91 ABNA 0417 1643 00'); | ||
* // returns "NL91ABNA0417164300" | ||
* ibantools.electronicFormatIBAN("NL91 ABNA 0417 1643 00"); | ||
* @alias module:ibantools.electronicFormatIBAN | ||
@@ -161,15 +150,15 @@ * @param {string} IBAN IBAN | ||
* @example | ||
* // returns 'NL91 ABNA 0417 1643 00' | ||
* ibantools.friendlyFormatIBAN('NL91ABNA0417164300'); | ||
* // returns "NL91 ABNA 0417 1643 00" | ||
* ibantools.friendlyFormatIBAN("NL91ABNA0417164300"); | ||
* @example | ||
* // returns 'NL91-ABNA-0417-1643-00' | ||
* ibantools.friendlyFormatIBAN('NL91ABNA0417164300','-'); | ||
* // returns "NL91-ABNA-0417-1643-00" | ||
* ibantools.friendlyFormatIBAN("NL91ABNA0417164300","-"); | ||
* @alias module:ibantools.friendlyFormatIBAN | ||
* @param {string} IBAN IBAN | ||
* @param {string} separator Not required. Default separator is space ' ' | ||
* @param {string} separator Not required. Default separator is space " " | ||
* @return {string} IBAN Friendly formated IBAN | ||
*/ | ||
export function friendlyFormatIBAN(iban, separator) { | ||
if (typeof separator === 'undefined') { | ||
separator = ' '; | ||
if (typeof separator === "undefined") { | ||
separator = " "; | ||
} | ||
@@ -185,3 +174,3 @@ return electronicFormatIBAN(iban).replace(/(.{4})(?!$)/g, "$1" + separator); | ||
iban = iban.slice(3) + iban.slice(0, 4); | ||
var validationString = ''; | ||
var validationString = ""; | ||
for (var n = 1; n < iban.length; n++) { | ||
@@ -204,2 +193,5 @@ var c = iban.charCodeAt(n); | ||
* getCountrySpecifications | ||
* Returns specifications for all countries, even those who are not | ||
* members of IBAN registry. `IBANRegistry` field indicates if country | ||
* is member of not. | ||
* @example | ||
@@ -212,12 +204,12 @@ * // Validating IBAN form field after user selects his country | ||
* // </select> | ||
* $('#countries').select(function() { | ||
* $("#countries").select(function() { | ||
* // Find country | ||
* let country = ibantools.getCountrySpecifications()[$(this).val()]; | ||
* // Add country code letters to IBAN form field | ||
* $('input#iban').value($(this).val()); | ||
* // Add new value to 'pattern' attribute to #iban input text field | ||
* $('input#iban').attr('pattern', $(this).val() + '[0-9]{2}' + country.bban_regexp.slice(1).replace('$','')); | ||
* $("input#iban").value($(this).val()); | ||
* // Add new value to "pattern" attribute to #iban input text field | ||
* $("input#iban").attr("pattern", $(this).val() + "[0-9]{2}" + country.bban_regexp.slice(1).replace("$","")); | ||
* }); | ||
* @alias module:ibantools.getCountrySpecifications | ||
* @return {CountryMap} Object [countryCode: string]CountrySpec -> {chars: :number, bban_regexp: string, name: string} | ||
* @return {CountryMap} Object [countryCode: string]CountrySpec -> {chars: :number, bban_regexp: string, name: string, IBANRegistry: boolean} | ||
*/ | ||
@@ -231,12 +223,12 @@ export function getCountrySpecifications() { | ||
* // returns true | ||
* ibantools.isValidBIC('ABNANL2A'); | ||
* ibantools.isValidBIC("ABNANL2A"); | ||
* @example | ||
* // returns true | ||
* ibantools.isValidBIC('NEDSZAJJXXX'); | ||
* ibantools.isValidBIC("NEDSZAJJXXX"); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBIC('ABN4NL2A'); | ||
* ibantools.isValidBIC("ABN4NL2A"); | ||
* @example | ||
* // returns false | ||
* ibantools.isValidBIC('ABNA NL 2A'); | ||
* ibantools.isValidBIC("ABNA NL 2A"); | ||
* @alias module:ibantools.isValidBIC | ||
@@ -247,4 +239,5 @@ * @param {string} BIC BIC | ||
export function isValidBIC(bic) { | ||
var reg = new RegExp('^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$', ''); | ||
return reg.test(bic); | ||
var reg = new RegExp("^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$", ""); | ||
var spec = countrySpecs[bic.toUpperCase().slice(4, 6)]; | ||
return reg.test(bic) && spec !== undefined; | ||
} | ||
@@ -254,7 +247,7 @@ /** | ||
* @example | ||
* // returns {bankCode: 'ABNA', countryCode: 'NL', locationCode: '2A', branchCode: null, testBIC: flase, valid: true} | ||
* ibantools.extractBIC('ABNANL2A'); | ||
* // returns {bankCode: "ABNA", countryCode: "NL", countryName: "Netherlands", locationCode: "2A", branchCode: null, testBIC: flase, valid: true} | ||
* ibantools.extractBIC("ABNANL2A"); | ||
* @alias module:ibantools.extractBIC | ||
* @param {string} BIC BIC | ||
* @return {ExtractBICResult} Object {bancCode: string, countryCode: string, locationCode: string, branchCode: string, testBIC: boolean, valid: boolean} | ||
* @return {ExtractBICResult} Object {bancCode: string, countryCode: string, countryName: string, locationCode: string, branchCode: string, testBIC: boolean, valid: boolean} | ||
*/ | ||
@@ -266,5 +259,7 @@ export function extractBIC(bic) { | ||
result.countryCode = bic.slice(4, 6); | ||
var spec = countrySpecs[result.countryCode]; | ||
result.countryName = spec.name; | ||
result.locationCode = bic.slice(6, 8); | ||
result.testBIC = (result.locationCode[1] == '0' ? true : false); | ||
result.branchCode = (bic.length > 8 ? bic.slice(8) : '619'); | ||
result.testBIC = (result.locationCode[1] === "0" ? true : false); | ||
result.branchCode = (bic.length > 8 ? bic.slice(8) : "619"); | ||
result.valid = true; | ||
@@ -277,100 +272,254 @@ } | ||
} | ||
/** | ||
* Fill map of IBAN country specifications | ||
*/ | ||
countrySpecs['AD'] = { chars: 24, bban_regexp: '^[0-9]{8}[A-Z0-9]{12}$', name: 'Andorra' }; | ||
countrySpecs['AE'] = { chars: 23, bban_regexp: '^[0-9]{3}[0-9]{16}$', name: 'United Arab Emirates' }; | ||
countrySpecs['AL'] = { chars: 28, bban_regexp: '^[0-9]{8}[A-Z0-9]{16}$', name: 'Albania' }; | ||
countrySpecs['AT'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Austria' }; | ||
countrySpecs['AZ'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{20}$', name: 'Republic of Azerbaijan' }; | ||
countrySpecs['BA'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Bosnia and Herzegovina' }; | ||
countrySpecs['BE'] = { chars: 16, bban_regexp: '^[0-9]{12}$', name: 'Belgium' }; | ||
countrySpecs['BG'] = { chars: 22, bban_regexp: '^[A-Z]{4}[0-9]{6}[A-Z0-9]{8}$', name: 'Bulgaria' }; | ||
countrySpecs['BH'] = { chars: 22, bban_regexp: '^[A-Z]{4}[A-Z0-9]{14}$', name: 'Bahrain' }; | ||
countrySpecs['BR'] = { chars: 29, bban_regexp: '^[0-9]{23}[A-Z]{1}[A-Z0-9]{1}$', name: 'Brazil' }; | ||
countrySpecs['BY'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{4}[A-Z0-9]{16}$', name: 'Republic of Belarus' }; | ||
countrySpecs['CH'] = { chars: 21, bban_regexp: '^[0-9]{5}[A-Z0-9]{12}$', name: 'Switzerland' }; | ||
countrySpecs['CR'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Costa Rica' }; | ||
countrySpecs['CY'] = { chars: 28, bban_regexp: '^[0-9]{8}[A-Z0-9]{16}$', name: 'Cyprus' }; | ||
countrySpecs['CZ'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Czech Republic' }; | ||
countrySpecs['DE'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Germany' }; | ||
// Denmark | ||
countrySpecs['DK'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Denmark' }; | ||
countrySpecs['FO'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Faroe Islands (Denmark)' }; | ||
countrySpecs['GL'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Greenland (Denmark)' }; | ||
// End Denmark | ||
countrySpecs['DO'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{20}$', name: 'Dominican Republic' }; | ||
countrySpecs['EE'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Estonia' }; | ||
countrySpecs['ES'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Spain' }; | ||
// Finland | ||
countrySpecs['FI'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Finland' }; | ||
countrySpecs['AX'] = { chars: 18, bban_regexp: '^[0-9]{14}$', name: 'Aland Islands (Finland)' }; | ||
// End Finland | ||
// France | ||
countrySpecs['FR'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'France' }; | ||
countrySpecs['GF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'French Guyana (France)' }; | ||
countrySpecs['GP'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Guadeloupe (France)' }; | ||
countrySpecs['MQ'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Martinique (France)' }; | ||
countrySpecs['RE'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Reunion (France)' }; | ||
countrySpecs['PF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'French Polynesia (France)' }; | ||
countrySpecs['TF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'French Southern Territories (France)' }; | ||
countrySpecs['YT'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Mayotte (France)' }; | ||
countrySpecs['NC'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'New Caledonia (France)' }; | ||
countrySpecs['BL'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Saint Barthelemy (France)' }; | ||
countrySpecs['MF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Saint Martin (France)' }; | ||
countrySpecs['PM'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Saint Pierre et Miquelon (France)' }; | ||
countrySpecs['WF'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Wallis and Futuna Islands (France)' }; | ||
// End France | ||
// United Kingdom | ||
countrySpecs['GB'] = { chars: 22, bban_regexp: '^[A-Z]{4}[0-9]{14}$', name: 'United Kingdom' }; | ||
// End united kingdom | ||
countrySpecs['GE'] = { chars: 22, bban_regexp: '^[A-Z0-9]{2}[0-9]{16}$', name: 'Georgia' }; | ||
countrySpecs['GI'] = { chars: 23, bban_regexp: '^[A-Z]{4}[A-Z0-9]{15}$', name: 'Gibraltar' }; | ||
countrySpecs['GR'] = { chars: 27, bban_regexp: '^[0-9]{7}[A-Z0-9]{16}$', name: 'Greece' }; | ||
countrySpecs['GT'] = { chars: 28, bban_regexp: '^[A-Z0-9]{24}$', name: 'Guatemala' }; | ||
countrySpecs['HR'] = { chars: 21, bban_regexp: '^[0-9]{17}$', name: 'Croatia' }; | ||
countrySpecs['HU'] = { chars: 28, bban_regexp: '^[0-9]{24}$', name: 'Hungary' }; | ||
countrySpecs['IE'] = { chars: 22, bban_regexp: '^[A-Z0-9]{4}[0-9]{14}$', name: 'Republic of Ireland' }; | ||
countrySpecs['IL'] = { chars: 23, bban_regexp: '^[0-9]{19}$', name: 'Israel' }; | ||
countrySpecs['IQ'] = { chars: 23, bban_regexp: '^[A-Z]{4}[0-9]{15}$', name: 'Iraq' }; | ||
countrySpecs['IS'] = { chars: 26, bban_regexp: '^[0-9]{22}$', name: 'Iceland' }; | ||
countrySpecs['IT'] = { chars: 27, bban_regexp: '^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$', name: 'Italy' }; | ||
countrySpecs['JO'] = { chars: 30, bban_regexp: '^[A-Z]{4}[0-9]{4}[A-Z0-9]{18}$', name: 'Jordan' }; | ||
countrySpecs['KW'] = { chars: 30, bban_regexp: '^[A-Z]{4}[A-Z0-9]{22}$', name: 'Kuwait' }; | ||
countrySpecs['KZ'] = { chars: 20, bban_regexp: '^[0-9]{3}[A-Z0-9]{13}$', name: 'Kazakhstan' }; | ||
countrySpecs['LB'] = { chars: 28, bban_regexp: '^[0-9]{4}[A-Z0-9]{20}$', name: 'Lebanon' }; | ||
countrySpecs['LC'] = { chars: 32, bban_regexp: '^[A-Z]{4}[A-Z0-9]{24}$', name: 'Saint Lucia' }; | ||
countrySpecs['LI'] = { chars: 21, bban_regexp: '^[0-9]{5}[A-Z0-9]{12}$', name: 'Liechtenstein' }; | ||
countrySpecs['LT'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Lithuania' }; | ||
countrySpecs['LU'] = { chars: 20, bban_regexp: '^[0-9]{3}[A-Z0-9]{13}$', name: 'Luxembourg' }; | ||
countrySpecs['LV'] = { chars: 21, bban_regexp: '^[A-Z]{4}[A-Z0-9]{13}$', name: 'Latvia' }; | ||
countrySpecs['MC'] = { chars: 27, bban_regexp: '^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$', name: 'Monaco' }; | ||
countrySpecs['MD'] = { chars: 24, bban_regexp: '^[A-Z0-9]{2}[A-Z0-9]{18}$', name: 'Moldova' }; | ||
countrySpecs['ME'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Montenegro' }; | ||
countrySpecs['MK'] = { chars: 19, bban_regexp: '^[0-9]{3}[A-Z0-9]{10}[0-9]{2}$', name: 'Republic of Macedonia' }; | ||
countrySpecs['MR'] = { chars: 27, bban_regexp: '^[0-9]{23}$', name: 'Mauritania' }; | ||
countrySpecs['MT'] = { chars: 31, bban_regexp: '^[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$', name: 'Malta' }; | ||
countrySpecs['MU'] = { chars: 30, bban_regexp: '^[A-Z]{4}[0-9]{19}[A-Z]{3}$', name: 'Mauritius' }; | ||
countrySpecs['NL'] = { chars: 18, bban_regexp: '^[A-Z]{4}[0-9]{10}$', name: 'Netherlands' }; | ||
countrySpecs['NO'] = { chars: 15, bban_regexp: '^[0-9]{11}$', name: 'Norway' }; | ||
countrySpecs['PK'] = { chars: 24, bban_regexp: '^[A-Z0-9]{4}[0-9]{16}$', name: 'Pakistan' }; | ||
countrySpecs['PL'] = { chars: 28, bban_regexp: '^[0-9]{24}$', name: 'Poland' }; | ||
countrySpecs['PS'] = { chars: 29, bban_regexp: '^[A-Z0-9]{4}[0-9]{21}$', name: 'State of Palestine' }; | ||
countrySpecs['PT'] = { chars: 25, bban_regexp: '^[0-9]{21}$', name: 'Portugal' }; | ||
countrySpecs['QA'] = { chars: 29, bban_regexp: '^[A-Z]{4}[A-Z0-9]{21}$', name: 'Qatar' }; | ||
countrySpecs['RO'] = { chars: 24, bban_regexp: '^[A-Z]{4}[A-Z0-9]{16}$', name: 'Romania' }; | ||
countrySpecs['RS'] = { chars: 22, bban_regexp: '^[0-9]{18}$', name: 'Serbia' }; | ||
countrySpecs['SA'] = { chars: 24, bban_regexp: '^[0-9]{2}[A-Z0-9]{18}$', name: 'Saudi Arabia' }; | ||
countrySpecs['SC'] = { chars: 31, bban_regexp: '^[[A-Z]{4}[]0-9]{20}[A-Z]{3}$', name: 'Seychelles' }; | ||
countrySpecs['SE'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Sweden' }; | ||
countrySpecs['SI'] = { chars: 19, bban_regexp: '^[0-9]{15}$', name: 'Slovenia' }; | ||
countrySpecs['SK'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Slovak Republic' }; | ||
countrySpecs['SM'] = { chars: 27, bban_regexp: '^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$', name: 'San Marino' }; | ||
countrySpecs['ST'] = { chars: 25, bban_regexp: '^[0-9]{21}$', name: 'Sao Tome And Principe' }; | ||
countrySpecs['SV'] = { chars: 28, bban_regexp: '^[A-Z]{4}[0-9]{20}$', name: 'El Salvador' }; | ||
countrySpecs['TL'] = { chars: 23, bban_regexp: '^[0-9]{19}$', name: 'Timor-Leste' }; | ||
countrySpecs['TN'] = { chars: 24, bban_regexp: '^[0-9]{20}$', name: 'Tunisia' }; | ||
countrySpecs['TR'] = { chars: 26, bban_regexp: '^[0-9]{5}[A-Z0-9]{17}$', name: 'Turkey' }; | ||
countrySpecs['UA'] = { chars: 29, bban_regexp: '^[0-9]{6}[A-Z0-9]{19}$', name: 'Ukraine' }; | ||
countrySpecs['VG'] = { chars: 24, bban_regexp: '^[A-Z0-9]{4}[0-9]{16}$', name: 'British Virgin Islands' }; | ||
countrySpecs['XK'] = { chars: 20, bban_regexp: '^[0-9]{16}$', name: 'Kosovo' }; | ||
// Country specifications | ||
var countrySpecs = { | ||
AD: { chars: 24, bban_regexp: "^[0-9]{8}[A-Z0-9]{12}$", name: "Andorra", IBANRegistry: true }, | ||
AE: { chars: 23, bban_regexp: "^[0-9]{3}[0-9]{16}$", name: "United Arab Emirates", IBANRegistry: true }, | ||
AF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Afganistan" }, | ||
AG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Antigua and Bermuda" }, | ||
AI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Anguilla" }, | ||
AL: { chars: 28, bban_regexp: "^[0-9]{8}[A-Z0-9]{16}$", name: "Albania", IBANRegistry: true }, | ||
AM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Armenia" }, | ||
AO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Angola" }, | ||
AQ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Antartica" }, | ||
AR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Argentina" }, | ||
AS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "American Samoa" }, | ||
AT: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Austria", IBANRegistry: true }, | ||
AU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Australia" }, | ||
AW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Aruba" }, | ||
AX: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Åland Islands", IBANRegistry: true }, | ||
AZ: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{20}$", name: "Republic of Azerbaijan", IBANRegistry: true }, | ||
BA: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Bosnia and Herzegovina", IBANRegistry: true }, | ||
BB: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Barbados" }, | ||
BD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bangladesh" }, | ||
BE: { chars: 16, bban_regexp: "^[0-9]{12}$", name: "Belgium", IBANRegistry: true }, | ||
BF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Burkina Faso" }, | ||
BG: { chars: 22, bban_regexp: "^[A-Z]{4}[0-9]{6}[A-Z0-9]{8}$", name: "Bulgaria", IBANRegistry: true }, | ||
BH: { chars: 22, bban_regexp: "^[A-Z]{4}[A-Z0-9]{14}$", name: "Bahrain", IBANRegistry: true }, | ||
BI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Burundi" }, | ||
BJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Benin" }, | ||
BL: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Saint Barthelemy", IBANRegistry: true }, | ||
BM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bermuda" }, | ||
BN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Brunei Darusslam" }, | ||
BO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bolivia, Plurinational State of" }, | ||
BQ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bonaire, Sint Eustatius and Saba" }, | ||
BR: { chars: 29, bban_regexp: "^[0-9]{23}[A-Z]{1}[A-Z0-9]{1}$", name: "Brazil", IBANRegistry: true }, | ||
BS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bahamas" }, | ||
BT: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bhutan" }, | ||
BV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Bouvet Island" }, | ||
BW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Botswana" }, | ||
BY: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{4}[A-Z0-9]{16}$", name: "Republic of Belarus", IBANRegistry: true }, | ||
BZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Belize" }, | ||
CA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Canada" }, | ||
CC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cocos (Keeling) Islands" }, | ||
CD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Congo, the Democratic Republic of the" }, | ||
CF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Central African Republic" }, | ||
CG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Congo" }, | ||
CH: { chars: 21, bban_regexp: "^[0-9]{5}[A-Z0-9]{12}$", name: "Switzerland", IBANRegistry: true }, | ||
CI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Côte d'Ivoire" }, | ||
CK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cook Islands" }, | ||
CL: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Chile" }, | ||
CM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cameroon" }, | ||
CN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "China" }, | ||
CO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Columbia" }, | ||
CR: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Costa Rica", IBANRegistry: true }, | ||
CU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cuba" }, | ||
CV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cabo Verde" }, | ||
CW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Curaçao" }, | ||
CX: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Christmas Island" }, | ||
CY: { chars: 28, bban_regexp: "^[0-9]{8}[A-Z0-9]{16}$", name: "Cyprus", IBANRegistry: true }, | ||
CZ: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Czech Republic", IBANRegistry: true }, | ||
DE: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Germany", IBANRegistry: true }, | ||
DJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Djibouti" }, | ||
DK: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Denmark", IBANRegistry: true }, | ||
DM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Dominica" }, | ||
DO: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{20}$", name: "Dominican Republic", IBANRegistry: true }, | ||
DZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Algeria" }, | ||
EC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Ecuador" }, | ||
EE: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Estonia", IBANRegistry: true }, | ||
EG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Egypt" }, | ||
EH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Western Sahara" }, | ||
ER: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Eritrea" }, | ||
ES: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Spain", IBANRegistry: true }, | ||
ET: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Ethiopia" }, | ||
FI: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Finland", IBANRegistry: true }, | ||
FJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Fiji" }, | ||
FK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Falkland Islands (Malvinas)" }, | ||
FM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Micronesia, Federated States of" }, | ||
FO: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Faroe Islands (Denmark)", IBANRegistry: true }, | ||
FR: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "France", IBANRegistry: true }, | ||
GA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Gabon" }, | ||
GB: { chars: 22, bban_regexp: "^[A-Z]{4}[0-9]{14}$", name: "United Kingdom", IBANRegistry: true }, | ||
GD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Grenada" }, | ||
GE: { chars: 22, bban_regexp: "^[A-Z0-9]{2}[0-9]{16}$", name: "Georgia", IBANRegistry: true }, | ||
GF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "French Guyana", IBANRegistry: true }, | ||
GG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guernsey" }, | ||
GH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Ghana" }, | ||
GI: { chars: 23, bban_regexp: "^[A-Z]{4}[A-Z0-9]{15}$", name: "Gibraltar", IBANRegistry: true }, | ||
GL: { chars: 18, bban_regexp: "^[0-9]{14}$", name: "Greenland", IBANRegistry: true }, | ||
GM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Gambia" }, | ||
GN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guinea" }, | ||
GP: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Guadeloupe", IBANRegistry: true }, | ||
GQ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Equatorial Guinea" }, | ||
GR: { chars: 27, bban_regexp: "^[0-9]{7}[A-Z0-9]{16}$", name: "Greece", IBANRegistry: true }, | ||
GS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "South Georgia and the South Sandwitch Islands" }, | ||
GT: { chars: 28, bban_regexp: "^[A-Z0-9]{24}$", name: "Guatemala", IBANRegistry: true }, | ||
GU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guam" }, | ||
GW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guinea-Bissau" }, | ||
GY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Guyana" }, | ||
HK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Hong Kong" }, | ||
HM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Heard Island and McDonald Islands" }, | ||
HN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Honduras" }, | ||
HR: { chars: 21, bban_regexp: "^[0-9]{17}$", name: "Croatia", IBANRegistry: true }, | ||
HT: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Haiti" }, | ||
HU: { chars: 28, bban_regexp: "^[0-9]{24}$", name: "Hungary", IBANRegistry: true }, | ||
ID: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Indonesia" }, | ||
IE: { chars: 22, bban_regexp: "^[A-Z0-9]{4}[0-9]{14}$", name: "Republic of Ireland", IBANRegistry: true }, | ||
IL: { chars: 23, bban_regexp: "^[0-9]{19}$", name: "Israel", IBANRegistry: true }, | ||
IM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Isle of Man" }, | ||
IN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "India" }, | ||
IO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "British Indian Ocean Territory" }, | ||
IQ: { chars: 23, bban_regexp: "^[A-Z]{4}[0-9]{15}$", name: "Iraq", IBANRegistry: true }, | ||
IR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Iran, Islamic Republic of" }, | ||
IS: { chars: 26, bban_regexp: "^[0-9]{22}$", name: "Iceland", IBANRegistry: true }, | ||
IT: { chars: 27, bban_regexp: "^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$", name: "Italy", IBANRegistry: true }, | ||
JE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Jersey" }, | ||
JM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Jamaica" }, | ||
JO: { chars: 30, bban_regexp: "^[A-Z]{4}[0-9]{4}[A-Z0-9]{18}$", name: "Jordan", IBANRegistry: true }, | ||
JP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Japan" }, | ||
KE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Kenya" }, | ||
KG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Kyrgyzstan" }, | ||
KH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cambodia" }, | ||
KI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Kiribati" }, | ||
KM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Comoros" }, | ||
KN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Saint Kitts and Nevis" }, | ||
KP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Korea, Domocratic People's Republic of" }, | ||
KR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Korea, Republic of" }, | ||
KW: { chars: 30, bban_regexp: "^[A-Z]{4}[A-Z0-9]{22}$", name: "Kuwait", IBANRegistry: true }, | ||
KY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Cayman Islands" }, | ||
KZ: { chars: 20, bban_regexp: "^[0-9]{3}[A-Z0-9]{13}$", name: "Kazakhstan", IBANRegistry: true }, | ||
LA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Lao People's Democratic Republic" }, | ||
LB: { chars: 28, bban_regexp: "^[0-9]{4}[A-Z0-9]{20}$", name: "Lebanon", IBANRegistry: true }, | ||
LC: { chars: 32, bban_regexp: "^[A-Z]{4}[A-Z0-9]{24}$", name: "Saint Lucia", IBANRegistry: true }, | ||
LI: { chars: 21, bban_regexp: "^[0-9]{5}[A-Z0-9]{12}$", name: "Liechtenstein", IBANRegistry: true }, | ||
LK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Sri Lanka" }, | ||
LR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Liberia" }, | ||
LS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Lesotho" }, | ||
LT: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Lithuania", IBANRegistry: true }, | ||
LU: { chars: 20, bban_regexp: "^[0-9]{3}[A-Z0-9]{13}$", name: "Luxembourg", IBANRegistry: true }, | ||
LV: { chars: 21, bban_regexp: "^[A-Z]{4}[A-Z0-9]{13}$", name: "Latvia", IBANRegistry: true }, | ||
LY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Libya" }, | ||
MA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Marocco" }, | ||
MC: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Monaco", IBANRegistry: true }, | ||
MD: { chars: 24, bban_regexp: "^[A-Z0-9]{2}[A-Z0-9]{18}$", name: "Moldova", IBANRegistry: true }, | ||
ME: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Montenegro", IBANRegistry: true }, | ||
MF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Saint Martin", IBANRegistry: true }, | ||
MG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Madagascar" }, | ||
MH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Marshall Islands" }, | ||
MK: { chars: 19, bban_regexp: "^[0-9]{3}[A-Z0-9]{10}[0-9]{2}$", name: "Macedonia, the former Yugoslav Republic of", IBANRegistry: true }, | ||
ML: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mali" }, | ||
MM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Myanman" }, | ||
MN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mongolia" }, | ||
MO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Macao" }, | ||
MP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Northern mariana Islands" }, | ||
MQ: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Martinique", IBANRegistry: true }, | ||
MR: { chars: 27, bban_regexp: "^[0-9]{23}$", name: "Mauritania", IBANRegistry: true }, | ||
MS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Montserrat" }, | ||
MT: { chars: 31, bban_regexp: "^[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$", name: "Malta", IBANRegistry: true }, | ||
MU: { chars: 30, bban_regexp: "^[A-Z]{4}[0-9]{19}[A-Z]{3}$", name: "Mauritius", IBANRegistry: true }, | ||
MV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Maldives" }, | ||
MW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Malawi" }, | ||
MX: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mexico" }, | ||
MY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Malaysia" }, | ||
MZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Mozambique" }, | ||
NA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Namibia" }, | ||
NC: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "New Caledonia", IBANRegistry: true }, | ||
NE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Niger" }, | ||
NF: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Norfolk Island" }, | ||
NG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nigeria" }, | ||
NI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nicaraqua" }, | ||
NL: { chars: 18, bban_regexp: "^[A-Z]{4}[0-9]{10}$", name: "Netherlands", IBANRegistry: true }, | ||
NO: { chars: 15, bban_regexp: "^[0-9]{11}$", name: "Norway", IBANRegistry: true }, | ||
NP: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nepal" }, | ||
NR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Nauru" }, | ||
NU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Niue" }, | ||
NZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "New Zealand" }, | ||
OM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Oman" }, | ||
PA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Panama" }, | ||
PE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Peru" }, | ||
PF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "French Polynesia", IBANRegistry: true }, | ||
PG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Papua New Guinea" }, | ||
PH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Philippines" }, | ||
PK: { chars: 24, bban_regexp: "^[A-Z0-9]{4}[0-9]{16}$", name: "Pakistan", IBANRegistry: true }, | ||
PL: { chars: 28, bban_regexp: "^[0-9]{24}$", name: "Poland", IBANRegistry: true }, | ||
PM: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Saint Pierre et Miquelon", IBANRegistry: true }, | ||
PN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Pitcairn" }, | ||
PR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Puerto Rico" }, | ||
PS: { chars: 29, bban_regexp: "^[A-Z0-9]{4}[0-9]{21}$", name: "Palestine, State of", IBANRegistry: true }, | ||
PT: { chars: 25, bban_regexp: "^[0-9]{21}$", name: "Portugal", IBANRegistry: true }, | ||
PW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Palau" }, | ||
PY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Paraguay" }, | ||
QA: { chars: 29, bban_regexp: "^[A-Z]{4}[A-Z0-9]{21}$", name: "Qatar", IBANRegistry: true }, | ||
RE: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Reunion", IBANRegistry: true }, | ||
RO: { chars: 24, bban_regexp: "^[A-Z]{4}[A-Z0-9]{16}$", name: "Romania", IBANRegistry: true }, | ||
RS: { chars: 22, bban_regexp: "^[0-9]{18}$", name: "Serbia", IBANRegistry: true }, | ||
RU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Russian Federation" }, | ||
RW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Rwanda" }, | ||
SA: { chars: 24, bban_regexp: "^[0-9]{2}[A-Z0-9]{18}$", name: "Saudi Arabia", IBANRegistry: true }, | ||
SB: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Solomon Islands" }, | ||
SC: { chars: 31, bban_regexp: "^[[A-Z]{4}[]0-9]{20}[A-Z]{3}$", name: "Seychelles", IBANRegistry: true }, | ||
SD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Sudan" }, | ||
SE: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Sweden", IBANRegistry: true }, | ||
SG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Singapore" }, | ||
SH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Saint Helena, Ascension and Tristan da Cunha" }, | ||
SI: { chars: 19, bban_regexp: "^[0-9]{15}$", name: "Slovenia", IBANRegistry: true }, | ||
SJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Svalbard and Jan Mayen" }, | ||
SK: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Slovak Republic", IBANRegistry: true }, | ||
SL: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Siera Leone" }, | ||
SM: { chars: 27, bban_regexp: "^[A-Z]{1}[0-9]{10}[A-Z0-9]{12}$", name: "San Marino", IBANRegistry: true }, | ||
SN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Senegal" }, | ||
SO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Somalia" }, | ||
SR: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Suriname" }, | ||
SS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "South Sudan" }, | ||
ST: { chars: 25, bban_regexp: "^[0-9]{21}$", name: "Sao Tome And Principe", IBANRegistry: true }, | ||
SV: { chars: 28, bban_regexp: "^[A-Z]{4}[0-9]{20}$", name: "El Salvador", IBANRegistry: true }, | ||
SX: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Sint Maarten (Dutch part)" }, | ||
SY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Syrian Arab Republic" }, | ||
SZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Swaziland" }, | ||
TC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Turks and Caicos Islands" }, | ||
TD: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Chad" }, | ||
TF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "French Southern Territories", IBANRegistry: true }, | ||
TG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Togo" }, | ||
TH: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Thailand" }, | ||
TJ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tajikistan" }, | ||
TK: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tokelau" }, | ||
TL: { chars: 23, bban_regexp: "^[0-9]{19}$", name: "Timor-Leste", IBANRegistry: true }, | ||
TM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Turkmenistan" }, | ||
TN: { chars: 24, bban_regexp: "^[0-9]{20}$", name: "Tunisia", IBANRegistry: true }, | ||
TO: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tonga" }, | ||
TR: { chars: 26, bban_regexp: "^[0-9]{5}[A-Z0-9]{17}$", name: "Turkey", IBANRegistry: true }, | ||
TT: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Trinidad and Tobago" }, | ||
TV: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tuvalu" }, | ||
TW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Taiwan, Province of China" }, | ||
TZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Tanzania, United republic of" }, | ||
UA: { chars: 29, bban_regexp: "^[0-9]{6}[A-Z0-9]{19}$", name: "Ukraine", IBANRegistry: true }, | ||
UG: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Uganda" }, | ||
UM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "United States Minor Outlying Islands" }, | ||
US: { chars: null, bban_regexp: null, IBANRegistry: false, name: "United States of America" }, | ||
UY: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Uruguay" }, | ||
UZ: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Uzbekistan" }, | ||
VA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Holy See" }, | ||
VC: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Saint Vincent and the Granadines" }, | ||
VE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Venezuela, Bolivian Republic of" }, | ||
VG: { chars: 24, bban_regexp: "^[A-Z0-9]{4}[0-9]{16}$", name: "Virgin Islands, British", IBANRegistry: true }, | ||
VI: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Virgin Islands, U.S." }, | ||
VN: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Viet Nam" }, | ||
VU: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Vanautu" }, | ||
WF: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Wallis and Futuna", IBANRegistry: true }, | ||
WS: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Samoa" }, | ||
XK: { chars: 20, bban_regexp: "^[0-9]{16}$", name: "Kosovo", IBANRegistry: true }, | ||
YE: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Yemen" }, | ||
YT: { chars: 27, bban_regexp: "^[0-9]{10}[A-Z0-9]{11}[0-9]{2}$", name: "Mayotte", IBANRegistry: true }, | ||
ZA: { chars: null, bban_regexp: null, IBANRegistry: false, name: "South Africa" }, | ||
ZM: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Zambia" }, | ||
ZW: { chars: null, bban_regexp: null, IBANRegistry: false, name: "Zimbabwe" }, | ||
}; |
{ | ||
"name": "ibantools", | ||
"version": "1.6.0", | ||
"description": "Validation, extraction and creation of IBAN, BBAN, BIC/SWIFT numbers plus some other helpful stuff", | ||
"version": "2.0.0", | ||
"description": "Validation, extraction and creation of IBAN, BBAN, BIC/SWIFT numbers plus some other helpful stuff like ISO 3136-1 alpha 2 country list", | ||
"keywords": [ | ||
@@ -9,3 +9,4 @@ "IBAN", | ||
"BIC", | ||
"SWIFT" | ||
"SWIFT", | ||
"ISO 3136-1 alpha-2" | ||
], | ||
@@ -62,3 +63,3 @@ "homepage": "https://github.com/Simplify/ibantools", | ||
"istanbul": "^0.4", | ||
"jasmine-core": "^2.99.1", | ||
"jasmine-core": "^3.1", | ||
"jsdoc": "^3.5.5", | ||
@@ -75,4 +76,5 @@ "karma": "^2.0", | ||
"run-sequence": "^2.2.1", | ||
"typescript": "^2.7" | ||
"typescript": "^2.7", | ||
"tslint": "^5.9.1" | ||
} | ||
} |
@@ -38,7 +38,10 @@ # IBANTools | ||
See [full documentation](http://simplify.github.io/ibantools) with examples on Github pages. | ||
### Node.js - CommonJS | ||
```js | ||
var ibantools = require('ibantools'); | ||
ibantools.isValidIBAN('NL91 ABNA 0517 1643 00'); | ||
const ibantools = require('ibantools'); | ||
const iban = electronicFormatIBAN('NL91 ABNA 0517 1643 00'); // 'NL91ABNA0517164300' | ||
ibantools.isValidIBAN(iban); | ||
ibantools.isValidBIC('ABNANL2A'); | ||
@@ -70,6 +73,2 @@ ``` | ||
## API | ||
See [documentation](http://simplify.github.io/ibantools) with examples on Github pages. | ||
## Contributing | ||
@@ -76,0 +75,0 @@ |
Sorry, the diff of this file is not supported yet
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
94153
1195
26
84