diff --git a/dist/costa-rica-iban.d.ts b/dist/costa-rica-iban.d.ts new file mode 100644 index 0000000..b869e7e --- /dev/null +++ b/dist/costa-rica-iban.d.ts @@ -0,0 +1,28 @@ +export interface BankObject { + code: string; + entity: string; + category: string; + participation: string; + representative: string; +} +export declare const NOT_STRING_ERROR: Error; +export declare const INVALID_IBAN_ERROR: Error; +export declare const getCountryPrefixFromIBAN: (iban: string) => string; +export declare const verifyIBANCountryPrefix: (iban: string) => boolean; +export declare const verifyIBANLength: (iban: string) => boolean; +export declare const verifyIBANFormat: (iban: string) => boolean; +export declare const getBankCodeFromIBAN: (iban: string) => string; +export declare const getBankObjectFromIBAN: (iban: string) => BankObject; +export declare const getBankNameFromIBAN: (iban: string, returnRepresentative?: boolean) => string; +export declare const getBankCategoryFromIBAN: (iban: string, returnRepresentative?: boolean) => string; +declare class CostaRicaIBAN { + iban: string; + constructor(iban: string); + getCountryPrefix(): string; + getBankCode(): string; + getBankObject(): BankObject; + getBankName(): string; + getBankCategory(): string; + getVersion: () => string; +} +export default CostaRicaIBAN; diff --git a/dist/costa-rica-iban.js b/dist/costa-rica-iban.js new file mode 100644 index 0000000..fc542e9 --- /dev/null +++ b/dist/costa-rica-iban.js @@ -0,0 +1,715 @@ +var CostaRicaIBAN = (() => { + var __defProp = Object.defineProperty; + var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); + var __export = (target, all) => { + __markAsModule(target); + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + + // src/index.ts + var src_exports = {}; + __export(src_exports, { + INVALID_IBAN_ERROR: () => INVALID_IBAN_ERROR, + NOT_STRING_ERROR: () => NOT_STRING_ERROR, + default: () => src_default, + getBankCategoryFromIBAN: () => getBankCategoryFromIBAN, + getBankCodeFromIBAN: () => getBankCodeFromIBAN, + getBankNameFromIBAN: () => getBankNameFromIBAN, + getBankObjectFromIBAN: () => getBankObjectFromIBAN, + getCountryPrefixFromIBAN: () => getCountryPrefixFromIBAN, + verifyIBANCountryPrefix: () => verifyIBANCountryPrefix, + verifyIBANFormat: () => verifyIBANFormat, + verifyIBANLength: () => verifyIBANLength + }); + + // package.json + var version = "2.0.0"; + + // src/bank-collection.json + var bank_collection_default = [ + { + code: "100", + entity: "Banco Central de Costa Rica", + category: "", + participation: "asociada", + representative: "" + }, + { + code: "102", + entity: "BAC San Jos\xE9 S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "104", + entity: "Banco Davivienda (Costa Rica) S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "107", + entity: "Banco BCT S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "114", + entity: "Banco LAFISE S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "116", + entity: "Banca Prom\xE9rica S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "117", + entity: "Banco Citibank (Costa Rica) S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "120", + entity: "Banco Improsa S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "123", + entity: "Scotiabank de Costa Rica S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "125", + entity: "Banco Cathay de Costa Rica S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "126", + entity: "Banco General (Costa Rica) S.A.", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "312", + entity: "Banco de Soluciones de Costa Rica S.A. (BANSOLS.A.)", + category: "BANCO COMERCIAL PRIVADO", + participation: "asociada", + representative: "" + }, + { + code: "151", + entity: "Banco Nacional de Costa Rica", + category: "BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL", + participation: "asociada", + representative: "" + }, + { + code: "152", + entity: "Banco de Costa Rica", + category: "BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL", + participation: "asociada", + representative: "" + }, + { + code: "153", + entity: "Banco Cr\xE9dito Agr\xEDcola de Cartago", + category: "BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL", + participation: "asociada", + representative: "" + }, + { + code: "161", + entity: "Banco Popular y de Desarrollo Comunal", + category: "BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL", + participation: "asociada", + representative: "" + }, + { + code: "162", + entity: "Banco Hipotecario de la Vivienda", + category: "BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL", + participation: "asociada", + representative: "" + }, + { + code: "304", + entity: "Financiera Cafsa S.A.", + category: "EMPRESA FINANCIERA NO BANCARIA", + participation: "asociada", + representative: "" + }, + { + code: "310", + entity: "Financiera G&T Continental Costa Rica S.A.", + category: "EMPRESA FINANCIERA NO BANCARIA", + participation: "asociada", + representative: "" + }, + { + code: "321", + entity: "Financiera Multivalores S.A.", + category: "EMPRESA FINANCIERA NO BANCARIA", + participation: "asociada", + representative: "" + }, + { + code: "322", + entity: "Financiera Comeca S.A.", + category: "EMPRESA FINANCIERA NO BANCARIA", + participation: "asociada", + representative: "" + }, + { + code: "326", + entity: "Financiera Desyfin S.A.", + category: "EMPRESA FINANCIERA NO BANCARIA", + participation: "asociada", + representative: "" + }, + { + code: "406", + entity: "Latin American Exchange Casa de Cambio S.A (Latinex)", + category: "CASA DE CAMBIO", + participation: "asociada", + representative: "" + }, + { + code: "450", + entity: "Citi Tarjetas de Costa Rica S.A.", + category: "ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS", + participation: "asociada", + representative: "" + }, + { + code: "451", + entity: "Evertec Costa Rica S.A.", + category: "ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS", + participation: "asociada", + representative: "" + }, + { + code: "501", + entity: "Bolsa Nacional de Valores S.A.", + category: "ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS", + participation: "asociada", + representative: "" + }, + { + code: "745", + entity: "Central de Valores Bolsa Nacional de Valores (CEVAL)", + category: "ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS", + participation: "asociada", + representative: "" + }, + { + code: "837", + entity: "Credomatic", + category: "ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS", + participation: "representada", + representative: "BAC San Jos\xE9" + }, + { + code: "553", + entity: "Inversiones Sama S.A.", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "554", + entity: "Mercado de Valores de C.R.", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "556", + entity: "BCT Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "558", + entity: "Citi Valores Accival S.A.", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "559", + entity: "ACOBO", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "568", + entity: "INS Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "569", + entity: "Lafise Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "570", + entity: "Davivienda Puesto de Bolsa (Costa Rica) S.A.", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "571", + entity: "Scotia Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "574", + entity: "Mutual Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "577", + entity: "Aldesa Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "581", + entity: "BAC San Jos\xE9", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "586", + entity: "BN Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "587", + entity: "Popular Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "588", + entity: "BCR Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "594", + entity: "Improsa Valores", + category: "PUESTO DE BOLSA", + participation: "asociada", + representative: "" + }, + { + code: "651", + entity: "BN-VITAL Operadora de Planes de Pensiones Complementarias S.A.", + category: "FONDO DE PENSION", + participation: "asociada", + representative: "" + }, + { + code: "653", + entity: "Vida Plena Operadora de Pensiones Complementarias S.A.", + category: "FONDO DE PENSION", + participation: "asociada", + representative: "" + }, + { + code: "654", + entity: "Caja Costarricense de Seguro Social Operadora de Pensiones Complementarias", + category: "FONDO DE PENSION", + participation: "asociada", + representative: "" + }, + { + code: "655", + entity: "Bac San Jos\xE9 Operadora de Pensiones Complementarias", + category: "FONDO DE PENSION", + participation: "asociada", + representative: "" + }, + { + code: "656", + entity: "Operadora de Planes de Pensiones Complementarias del Banco Popular y Desarrollo Comunal", + category: "FONDO DE PENSION", + participation: "asociada", + representative: "" + }, + { + code: "657", + entity: "BCR Operadora Planes de Pensiones Complementarias S.A.", + category: "FONDO DE PENSION", + participation: "asociada", + representative: "" + }, + { + code: "725", + entity: "MIDEPLAN", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "730", + entity: "Instituto de Fomento y Asesor\xEDa Municipal (IFAM)", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "731", + entity: "Instituto Costarricense sobre Drogas (ICD)", + category: "INSTITUCION PUBLICA", + participation: "", + representative: "" + }, + { + code: "734", + entity: "Instituto Costarricense de Electricidad (ICE)", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "735", + entity: "Recope", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "739", + entity: "Ministerio de Hacienda", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "746", + entity: "Caja Costarricense de Seguro Social (CCSS)", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "747", + entity: "Instituto Nacional de Seguros (INS)", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "750", + entity: "Gob. Tribunal Supremo de Elecciones (TSE)", + category: "INSTITUCION PUBLICA", + participation: "", + representative: "" + }, + { + code: "754", + entity: "Junta de Protecci\xF3n Social de San Jos\xE9", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "755", + entity: "Municipalidad de San Jos\xE9", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "756", + entity: "Radiogr\xE1fica Costarricense S.A. (RACSA)", + category: "INSTITUCION PUBLICA", + participation: "asociada", + representative: "" + }, + { + code: "757", + entity: "Municipalidad de Cartago", + category: "INSTITUCION PUBLICA", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "838", + entity: "Promotora del Comercio Exterior de Costa Rica (Procomer)", + category: "INSTITUCION PUBLICA", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "803", + entity: "Grupo Mutual Alajuela la Vivienda", + category: "MUTUAL DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "804", + entity: "Mutual Cartago de Ahorro y Pr\xE9stamo", + category: "MUTUAL DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "180", + entity: "COOPEACOSTA", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "811", + entity: "Cooperativa de Ahorro y Cr\xE9dito de la Comunidad de Ciudad Quesada R. L. (COOCIQUE)", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "812", + entity: "COOPE SAN MARCOS", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "813", + entity: "Cooperativa de Ahorro y Cr\xE9dito Alianza de P\xE9rez Zeled\xF3n (COOPEALIANZA)", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "814", + entity: "Cooperativa Nacional de Educadores. R.L. (COOPENAE)", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "815", + entity: "SERVICOOP R.L.", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "816", + entity: "Cooperativa de Ahorro y Cr\xE9dito de Servidores P\xFAblicos R.L. (COOPESERVIDORES)", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "817", + entity: "Cooperativa de Ahorro y Cr\xE9dito ANDE N\xBA 1 R.L. (COOPEANDE).", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "820", + entity: "Coop. COOPECAJA", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "821", + entity: "Caja de Ahorro y Pr\xE9stamos de ANDE", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "822", + entity: "COOPEMEP R.L.", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "asociada", + representative: "" + }, + { + code: "824", + entity: "CREDECOOP", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "825", + entity: "COOPESAN RAMON", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "827", + entity: "COOPEBANPO", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "829", + entity: "COOPEAMISTAD", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "831", + entity: "COOPEGRECIA", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "832", + entity: "COOPAVEGRA", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "833", + entity: "COOPEUNA", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "834", + entity: "COOPEANDE No. 7 R.L.", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "835", + entity: "COOPESPARTA R.L.", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + }, + { + code: "836", + entity: "COOPEASERRI R.L.", + category: "COOPERATIVA DE AHORRO Y PRESTAMO", + participation: "representada", + representative: "COOPENAE" + } + ]; + + // src/index.ts + var bankCodes = bank_collection_default.map((b) => b.code); + var NOT_STRING_ERROR = new Error("Type Error: expected string"); + var INVALID_IBAN_ERROR = new Error("Format Error: invalid Costa Rica IBAN format"); + var errorIfNotString = (varToverify) => { + if (typeof varToverify !== "string") { + throw NOT_STRING_ERROR; + } + }; + var getCountryPrefixFromIBAN = (iban) => { + errorIfNotString(iban); + return iban.slice(0, 2); + }; + var verifyIBANCountryPrefix = (iban) => { + errorIfNotString(iban); + return getCountryPrefixFromIBAN(iban) === "CR"; + }; + var verifyIBANLength = (iban) => { + errorIfNotString(iban); + return iban.length === 22; + }; + var verifyIBANFormat = (iban) => { + errorIfNotString(iban); + return /^CR\d\d0(1|[3-8])\d{16}$/.test(iban) && bankCodes.indexOf(iban.slice(5, 8)) > -1; + }; + var errorOnInvalidIBAN = (iban) => { + if (!verifyIBANFormat(iban)) { + throw INVALID_IBAN_ERROR; + } + }; + var getBankCodeFromIBAN = (iban) => { + errorOnInvalidIBAN(iban); + return iban.slice(5, 8); + }; + var getBankObjectFromIBAN = (iban) => { + const bankCode = getBankCodeFromIBAN(iban); + const bankIndex = bankCodes.indexOf(bankCode); + return bank_collection_default[bankIndex]; + }; + var getBankNameFromIBAN = (iban, returnRepresentative = false) => { + const bankObject = getBankObjectFromIBAN(iban); + return returnRepresentative && bankObject.participation === "representada" ? bankObject.representative : bankObject.entity; + }; + var getBankCategoryFromIBAN = (iban, returnRepresentative = false) => { + const bankObject = getBankObjectFromIBAN(iban); + return bankObject.category; + }; + var CostaRicaIBAN = class { + constructor(iban) { + this.getVersion = () => version; + errorOnInvalidIBAN(iban); + this.iban = iban; + } + getCountryPrefix() { + return getCountryPrefixFromIBAN(this.iban); + } + getBankCode() { + return getBankCodeFromIBAN(this.iban); + } + getBankObject() { + return getBankObjectFromIBAN(this.iban); + } + getBankName() { + return getBankNameFromIBAN(this.iban); + } + getBankCategory() { + return getBankCategoryFromIBAN(this.iban); + } + }; + var src_default = CostaRicaIBAN; + return src_exports; +})(); +//# sourceMappingURL=costa-rica-iban.js.map +'undefined'!=typeof module&&(module.exports=CostaRicaIBAN.default),'undefined'!=typeof window&&(CostaRicaIBAN=CostaRicaIBAN.default); \ No newline at end of file diff --git a/dist/costa-rica-iban.js.map b/dist/costa-rica-iban.js.map new file mode 100644 index 0000000..4bbe84b --- /dev/null +++ b/dist/costa-rica-iban.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts"], + "sourcesContent": ["// @ts-ignore\nimport { version } from '../package.json';\nimport bankCollection from './bank-collection.json';\n\nconst bankCodes: string[] = bankCollection.map((b) => b.code);\n\nexport interface BankObject {\n code: string;\n entity: string;\n category: string;\n participation: string;\n representative: string;\n};\n\nexport const NOT_STRING_ERROR = new Error('Type Error: expected string');\nexport const INVALID_IBAN_ERROR = new Error('Format Error: invalid Costa Rica IBAN format');\n\n// Since the browser version of the library cannot make use of types,\n// we added this helper to make sure the input is a string.\nconst errorIfNotString = (varToverify: any) => {\n if (typeof varToverify !== 'string') {\n throw NOT_STRING_ERROR;\n }\n};\n\nexport const getCountryPrefixFromIBAN = (iban: string) => {\n errorIfNotString(iban);\n\n return iban.slice(0, 2);\n};\n\nexport const verifyIBANCountryPrefix = (iban: string) => {\n errorIfNotString(iban);\n\n return getCountryPrefixFromIBAN(iban) === 'CR';\n};\n\nexport const verifyIBANLength = (iban: string) => {\n errorIfNotString(iban);\n\n return iban.length === 22;\n};\n\nexport const verifyIBANFormat = (iban: string) => {\n errorIfNotString(iban);\n\n return (/^CR\\d\\d0(1|[3-8])\\d{16}$/).test(iban)\n && bankCodes.indexOf(iban.slice(5, 8)) > -1;\n};\n\nconst errorOnInvalidIBAN = (iban: string) => {\n if (!verifyIBANFormat(iban)) {\n throw INVALID_IBAN_ERROR;\n }\n};\n\nexport const getBankCodeFromIBAN = (iban: string) => {\n errorOnInvalidIBAN(iban);\n\n return iban.slice(5, 8);\n};\n\nexport const getBankObjectFromIBAN = (iban: string) => {\n const bankCode = getBankCodeFromIBAN(iban);\n const bankIndex = bankCodes.indexOf(bankCode);\n\n return bankCollection[bankIndex] as BankObject;\n};\n\nexport const getBankNameFromIBAN = (iban: string, returnRepresentative = false) => {\n const bankObject = getBankObjectFromIBAN(iban);\n\n return (returnRepresentative && bankObject.participation === 'representada') ? (\n bankObject.representative\n ) : (\n bankObject.entity\n );\n};\n\nexport const getBankCategoryFromIBAN = (iban: string, returnRepresentative = false) => {\n const bankObject = getBankObjectFromIBAN(iban);\n\n return bankObject.category;\n};\n\nclass CostaRicaIBAN {\n iban: string;\n\n constructor(iban: string) {\n errorOnInvalidIBAN(iban);\n\n this.iban = iban;\n }\n\n getCountryPrefix() {\n return getCountryPrefixFromIBAN(this.iban);\n }\n\n getBankCode() {\n return getBankCodeFromIBAN(this.iban);\n }\n\n getBankObject() {\n return getBankObjectFromIBAN(this.iban);\n }\n\n getBankName() {\n return getBankNameFromIBAN(this.iban);\n }\n\n getBankCategory() {\n return getBankCategoryFromIBAN(this.iban);\n }\n\n getVersion = () => version;\n}\n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886812 100644 --- a/dist/costa-rica-iban.min.js +++ b/dist/costa-rica-iban.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("costa-rica-iban",[],t):"object"==typeof exports?exports["costa-rica-iban"]=t():e["costa-rica-iban"]=t()}(window,(function(){return function(e){var t={};function a(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(i,r,function(t){return e[t]}.bind(null,r));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){e.exports=a(1)},function(e,t,a){"use strict";function i(e,t){for(var a=0;a-1},C=function(e){if(!v(e))throw s},A=function(e){return C(e),e.slice(5,8)},O=function(e){var t=A(e),a=c.indexOf(t);return o[a]},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=O(e);return t&&"representada"===a.participation?a.representative:a.entity},E=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"iban",null),r(this,"getVersion",(function(){return n})),C(t),this.iban=t}var t,a,o;return t=e,(a=[{key:"getCountryPrefix",value:function(){return u(this.iban)}},{key:"getBankCode",value:function(){return A(this.iban)}},{key:"getBankObject",value:function(){return O(this.iban)}},{key:"getBankName",value:function(){return f(this.iban)}}])&&i(t.prototype,a),o&&i(t,o),e}();t.default=E},function(e){e.exports=JSON.parse('{"name":"costa-rica-iban","version":"1.0.3","main":"dist/costa-rica-iban.min.js","license":"MIT","scripts":{"build":"webpack --mode production","test":"jest","lint":"eslint --format codeframe --ext mjs,js src test","dist:update":"rm -rf ./dist && cp -r ./build ./dist","dist:commit":"git add ./dist && git commit -m \\"dist updated\\"","deploy":"yarn test && yarn build && yarn dist:update && yarn dist:commit && yarn publish"},"devDependencies":{"@babel/plugin-proposal-class-properties":"^7.8.3","@neutrinojs/airbnb-base":"^9.1.0","@neutrinojs/jest":"^9.1.0","@neutrinojs/library":"^9.1.0","babel-jest":"^25.1.0","eslint":"^6","jest":"^25","neutrino":"^9.1.0","webpack":"^4","webpack-chain":"^6.4.0","webpack-cli":"^3"}}')},function(e){e.exports=JSON.parse('[{"code":"100","entity":"Banco Central de Costa Rica","participation":"asociada","representative":""},{"code":"102","entity":"BAC San José S.A.","participation":"asociada","representative":""},{"code":"104","entity":"Banco Davivienda (Costa Rica) S.A.","participation":"asociada","representative":""},{"code":"107","entity":"Banco BCT, S. A.","participation":"asociada","representative":""},{"code":"114","entity":"Banco LAFISE S. A.","participation":"asociada","representative":""},{"code":"116","entity":"Banca Promérica S.A.","participation":"asociada","representative":""},{"code":"117","entity":"Banco Citibank (Costa Rica), S.A.","participation":"asociada","representative":""},{"code":"120","entity":"Banco Improsa S.A.","participation":"asociada","representative":""},{"code":"123","entity":"Scotiabank de Costa Rica S.A.","participation":"asociada","representative":""},{"code":"125","entity":"Banco Cathay de Costa Rica S.A.","participation":"asociada","representative":""},{"code":"126","entity":"Banco General (Costa Rica) S.A.","participation":"asociada","representative":""},{"code":"151","entity":"Banco Nacional de Costa Rica","participation":"asociada","representative":""},{"code":"152","entity":"Banco de Costa Rica","participation":"asociada","representative":""},{"code":"153","entity":"Banco Crédito Agrícola de Cartago","participation":"asociada","representative":""},{"code":"161","entity":"Banco Popular y de Desarrollo Comunal","participation":"asociada","representative":""},{"code":"162","entity":"Banco Hipotecario de la Vivienda","participation":"asociada","representative":""},{"code":"180","entity":"COOPEACOSTA","participation":"representada","representative":"COOPENAE"},{"code":"304","entity":"Financiera Cafsa S. A.","participation":"asociada","representative":""},{"code":"310","entity":"Financiera G&T Continental Costa Rica S. A.","participation":"asociada","representative":""},{"code":"312","entity":"Banco de Soluciones de Costa Rica S.A.","participation":"","representative":""},{"code":"321","entity":"Financiera Multivalores S. A.","participation":"asociada","representative":""},{"code":"322","entity":"Financiera Comeca S. A.","participation":"asociada","representative":""},{"code":"326","entity":"Financiera Desyfin S. A.","participation":"asociada","representative":""},{"code":"406","entity":"Latin American Exchange Casa de Cambio S.A(Latinex)","participation":"asociada","representative":""},{"code":"450","entity":"Citi Tarjetas de Costa Rica S.A.","participation":"asociada","representative":""},{"code":"451","entity":"Evertec Costa Rica S.A.","participation":"asociada","representative":""},{"code":"501","entity":"Bolsa Nacional de Valores S.A.","participation":"asociada","representative":""},{"code":"553","entity":"Inversiones Sama, S.A.","participation":"asociada","representative":""},{"code":"554","entity":"Mercado de Valores de C. R.","participation":"asociada","representative":""},{"code":"556","entity":"BCT Valores","participation":"asociada","representative":""},{"code":"558","entity":"Citi Valores Accival, S.A.","participation":"asociada","representative":""},{"code":"559","entity":"ACOBO","participation":"asociada","representative":""},{"code":"568","entity":"INS Valores","participation":"asociada","representative":""},{"code":"569","entity":"Lafise Valores","participation":"asociada","representative":""},{"code":"570","entity":"Davivienda Puesto de Bolsa (Costa Rica) S.A.","participation":"asociada","representative":""},{"code":"571","entity":"Scotia Valores","participation":"asociada","representative":""},{"code":"574","entity":"Mutual Valores","participation":"asociada","representative":""},{"code":"577","entity":"Aldesa Valores","participation":"asociada","representative":""},{"code":"581","entity":"BAC San José","participation":"asociada","representative":""},{"code":"586","entity":"BN Valores","participation":"asociada","representative":""},{"code":"587","entity":"Popular Valores","participation":"asociada","representative":""},{"code":"588","entity":"BCR Valores","participation":"asociada","representative":""},{"code":"594","entity":"Improsa Valores","participation":"asociada","representative":""},{"code":"651","entity":"BN-VITAL Operadora de Planes de Pensiones Complementarias, S. A.","participation":"asociada","representative":""},{"code":"653","entity":"Vida Plena Operadora de Pensiones Complementarias, S. A.","participation":"asociada","representative":""},{"code":"654","entity":"Caja Costarricense de Seguro Social Operadora de Pensiones Complementarias","participation":"asociada","representative":""},{"code":"655","entity":"Bac San José Operadora de Pensiones Complementarias","participation":"asociada","representative":""},{"code":"656","entity":"Operadora de Planes de Pensiones Complementarias del Banco Popular y Desarrollo Comunal","participation":"asociada","representative":""},{"code":"657","entity":"BCR Operadora Planes de Pensiones Complementarias S.A.","participation":"asociada","representative":""},{"code":"725","entity":"MIDEPLAN","participation":"asociada","representative":""},{"code":"730","entity":"Instituto de Fomento y Asesoría Municipal (IFAM)","participation":"asociada","representative":""},{"code":"731","entity":"Instituto Costarricense sobre Drogas (ICD)","participation":"","representative":""},{"code":"734","entity":"Instituto Costarricense de Electricidad (ICE)","participation":"asociada","representative":""},{"code":"735","entity":"Recope","participation":"asociada","representative":""},{"code":"739","entity":"Ministerio de Hacienda","participation":"asociada","representative":""},{"code":"745","entity":"Central de Valores Bolsa Nacional de Valores (CEVAL)","participation":"asociada","representative":""},{"code":"746","entity":"Caja Costarricense de Seguro Social (CCSS)","participation":"asociada","representative":""},{"code":"747","entity":"Instituto Nacional de Seguros (INS)","participation":"asociada","representative":""},{"code":"750","entity":"Gob. Tribunal Supremo de Elecciones (TSE)","participation":"","representative":""},{"code":"754","entity":"Junta de Protección Social de San José","participation":"asociada","representative":""},{"code":"755","entity":"Municipalidad de San José","participation":"asociada","representative":""},{"code":"756","entity":"Radiográfica Costarricense S.A. (RACSA)","participation":"asociada","representative":""},{"code":"757","entity":"Municipalidad de Cartago","participation":"representada","representative":"COOPENAE"},{"code":"803","entity":"Grupo Mutual Alajuela la Vivienda","participation":"asociada","representative":""},{"code":"804","entity":"Mutual Cartago de Ahorro y Préstamo","participation":"asociada","representative":""},{"code":"811","entity":"Cooperativa de Ahorro y Crédito de la Comunidad de Ciudad Quesada R. L. (COOCIQUE)","participation":"asociada","representative":""},{"code":"812","entity":"COOPE SAN MARCOS","participation":"representada","representative":"COOPENAE"},{"code":"813","entity":"Cooperativa de Ahorro y Crédito Alianza de Pérez Zeledón (COOPEALIANZA)","participation":"asociada","representative":""},{"code":"814","entity":"Cooperativa Nacional de Educadores. R.L. (COOPENAE)","participation":"asociada","representative":""},{"code":"815","entity":"SERVICOOP R.L.","participation":"representada","representative":"COOPENAE"},{"code":"816","entity":"Cooperativa de Ahorro y Crédito de Servidores Públicos R.L. (COOPESERVIDORES)","participation":"asociada","representative":""},{"code":"817","entity":"Cooperativa de Ahorro y Crédito ANDE Nº 1 R.L. (COOPEANDE).","participation":"asociada","representative":""},{"code":"820","entity":"Coop. COOPECAJA","participation":"representada","representative":"COOPENAE"},{"code":"821","entity":"Caja de Ahorro y Préstamos de ANDE","participation":"asociada","representative":""},{"code":"822","entity":"COOPEMEP R.L.","participation":"asociada","representative":""},{"code":"824","entity":"CREDECOOP","participation":"representada","representative":"COOPENAE"},{"code":"825","entity":"COOPESAN RAMON","participation":"representada","representative":"COOPENAE"},{"code":"827","entity":"COOPEBANPO","participation":"representada","representative":"COOPENAE"},{"code":"829","entity":"COOPEAMISTAD","participation":"representada","representative":"COOPENAE"},{"code":"831","entity":"COOPEGRECIA","participation":"representada","representative":"COOPENAE"},{"code":"832","entity":"COOPAVEGRA","participation":"representada","representative":"COOPENAE"},{"code":"833","entity":"COOPEUNA","participation":"representada","representative":"COOPENAE"},{"code":"834","entity":"COOPEANDE No. 7 R.L.","participation":"representada","representative":"COOPENAE"},{"code":"835","entity":"COOPESPARTA R.L.","participation":"representada","representative":"COOPENAE"},{"code":"836","entity":"COOPEASERRI R.L.","participation":"representada","representative":"COOPENAE"},{"code":"837","entity":"Credomatic","participation":"representada","representative":"BAC San José"},{"code":"838","entity":"Promotora del Comercio Exterior de Costa Rica (Procomer)","participation":"representada","representative":"COOPENAE"}]')}])})); -//# sourceMappingURL=costa-rica-iban.min.js.map \ No newline at end of file +var CostaRicaIBAN=(()=>{var s=Object.defineProperty;var P=e=>s(e,"__esModule",{value:!0});var S=(e,a)=>{P(e);for(var t in a)s(e,t,{get:a[t],enumerable:!0})};var B={};S(B,{INVALID_IBAN_ERROR:()=>d,NOT_STRING_ERROR:()=>O,default:()=>v,getBankCategoryFromIBAN:()=>I,getBankCodeFromIBAN:()=>c,getBankNameFromIBAN:()=>R,getBankObjectFromIBAN:()=>r,getCountryPrefixFromIBAN:()=>n,verifyIBANCountryPrefix:()=>D,verifyIBANFormat:()=>E,verifyIBANLength:()=>T});var A="2.0.0";var o=[{code:"100",entity:"Banco Central de Costa Rica",category:"",participation:"asociada",representative:""},{code:"102",entity:"BAC San Jos\xE9 S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"104",entity:"Banco Davivienda (Costa Rica) S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"107",entity:"Banco BCT S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"114",entity:"Banco LAFISE S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"116",entity:"Banca Prom\xE9rica S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"117",entity:"Banco Citibank (Costa Rica) S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"120",entity:"Banco Improsa S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"123",entity:"Scotiabank de Costa Rica S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"125",entity:"Banco Cathay de Costa Rica S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"126",entity:"Banco General (Costa Rica) S.A.",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"312",entity:"Banco de Soluciones de Costa Rica S.A. (BANSOLS.A.)",category:"BANCO COMERCIAL PRIVADO",participation:"asociada",representative:""},{code:"151",entity:"Banco Nacional de Costa Rica",category:"BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL",participation:"asociada",representative:""},{code:"152",entity:"Banco de Costa Rica",category:"BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL",participation:"asociada",representative:""},{code:"153",entity:"Banco Cr\xE9dito Agr\xEDcola de Cartago",category:"BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL",participation:"asociada",representative:""},{code:"161",entity:"Banco Popular y de Desarrollo Comunal",category:"BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL",participation:"asociada",representative:""},{code:"162",entity:"Banco Hipotecario de la Vivienda",category:"BANCO COMERCIAL PUBLICO, BPDC, OTRA ENTIDAD CREADA POR LEY ESPECIAL",participation:"asociada",representative:""},{code:"304",entity:"Financiera Cafsa S.A.",category:"EMPRESA FINANCIERA NO BANCARIA",participation:"asociada",representative:""},{code:"310",entity:"Financiera G&T Continental Costa Rica S.A.",category:"EMPRESA FINANCIERA NO BANCARIA",participation:"asociada",representative:""},{code:"321",entity:"Financiera Multivalores S.A.",category:"EMPRESA FINANCIERA NO BANCARIA",participation:"asociada",representative:""},{code:"322",entity:"Financiera Comeca S.A.",category:"EMPRESA FINANCIERA NO BANCARIA",participation:"asociada",representative:""},{code:"326",entity:"Financiera Desyfin S.A.",category:"EMPRESA FINANCIERA NO BANCARIA",participation:"asociada",representative:""},{code:"406",entity:"Latin American Exchange Casa de Cambio S.A (Latinex)",category:"CASA DE CAMBIO",participation:"asociada",representative:""},{code:"450",entity:"Citi Tarjetas de Costa Rica S.A.",category:"ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS",participation:"asociada",representative:""},{code:"451",entity:"Evertec Costa Rica S.A.",category:"ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS",participation:"asociada",representative:""},{code:"501",entity:"Bolsa Nacional de Valores S.A.",category:"ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS",participation:"asociada",representative:""},{code:"745",entity:"Central de Valores Bolsa Nacional de Valores (CEVAL)",category:"ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS",participation:"asociada",representative:""},{code:"837",entity:"Credomatic",category:"ENTIDAD LIQUIDADORA DE SERVICIOS Y EMISORA DE TARJETAS",participation:"representada",representative:"BAC San Jos\xE9"},{code:"553",entity:"Inversiones Sama S.A.",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"554",entity:"Mercado de Valores de C.R.",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"556",entity:"BCT Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"558",entity:"Citi Valores Accival S.A.",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"559",entity:"ACOBO",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"568",entity:"INS Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"569",entity:"Lafise Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"570",entity:"Davivienda Puesto de Bolsa (Costa Rica) S.A.",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"571",entity:"Scotia Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"574",entity:"Mutual Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"577",entity:"Aldesa Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"581",entity:"BAC San Jos\xE9",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"586",entity:"BN Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"587",entity:"Popular Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"588",entity:"BCR Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"594",entity:"Improsa Valores",category:"PUESTO DE BOLSA",participation:"asociada",representative:""},{code:"651",entity:"BN-VITAL Operadora de Planes de Pensiones Complementarias S.A.",category:"FONDO DE PENSION",participation:"asociada",representative:""},{code:"653",entity:"Vida Plena Operadora de Pensiones Complementarias S.A.",category:"FONDO DE PENSION",participation:"asociada",representative:""},{code:"654",entity:"Caja Costarricense de Seguro Social Operadora de Pensiones Complementarias",category:"FONDO DE PENSION",participation:"asociada",representative:""},{code:"655",entity:"Bac San Jos\xE9 Operadora de Pensiones Complementarias",category:"FONDO DE PENSION",participation:"asociada",representative:""},{code:"656",entity:"Operadora de Planes de Pensiones Complementarias del Banco Popular y Desarrollo Comunal",category:"FONDO DE PENSION",participation:"asociada",representative:""},{code:"657",entity:"BCR Operadora Planes de Pensiones Complementarias S.A.",category:"FONDO DE PENSION",participation:"asociada",representative:""},{code:"725",entity:"MIDEPLAN",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"730",entity:"Instituto de Fomento y Asesor\xEDa Municipal (IFAM)",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"731",entity:"Instituto Costarricense sobre Drogas (ICD)",category:"INSTITUCION PUBLICA",participation:"",representative:""},{code:"734",entity:"Instituto Costarricense de Electricidad (ICE)",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"735",entity:"Recope",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"739",entity:"Ministerio de Hacienda",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"746",entity:"Caja Costarricense de Seguro Social (CCSS)",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"747",entity:"Instituto Nacional de Seguros (INS)",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"750",entity:"Gob. Tribunal Supremo de Elecciones (TSE)",category:"INSTITUCION PUBLICA",participation:"",representative:""},{code:"754",entity:"Junta de Protecci\xF3n Social de San Jos\xE9",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"755",entity:"Municipalidad de San Jos\xE9",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"756",entity:"Radiogr\xE1fica Costarricense S.A. (RACSA)",category:"INSTITUCION PUBLICA",participation:"asociada",representative:""},{code:"757",entity:"Municipalidad de Cartago",category:"INSTITUCION PUBLICA",participation:"representada",representative:"COOPENAE"},{code:"838",entity:"Promotora del Comercio Exterior de Costa Rica (Procomer)",category:"INSTITUCION PUBLICA",participation:"representada",representative:"COOPENAE"},{code:"803",entity:"Grupo Mutual Alajuela la Vivienda",category:"MUTUAL DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"804",entity:"Mutual Cartago de Ahorro y Pr\xE9stamo",category:"MUTUAL DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"180",entity:"COOPEACOSTA",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"811",entity:"Cooperativa de Ahorro y Cr\xE9dito de la Comunidad de Ciudad Quesada R. L. (COOCIQUE)",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"812",entity:"COOPE SAN MARCOS",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"813",entity:"Cooperativa de Ahorro y Cr\xE9dito Alianza de P\xE9rez Zeled\xF3n (COOPEALIANZA)",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"814",entity:"Cooperativa Nacional de Educadores. R.L. (COOPENAE)",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"815",entity:"SERVICOOP R.L.",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"816",entity:"Cooperativa de Ahorro y Cr\xE9dito de Servidores P\xFAblicos R.L. (COOPESERVIDORES)",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"817",entity:"Cooperativa de Ahorro y Cr\xE9dito ANDE N\xBA 1 R.L. (COOPEANDE).",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"820",entity:"Coop. COOPECAJA",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"821",entity:"Caja de Ahorro y Pr\xE9stamos de ANDE",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"822",entity:"COOPEMEP R.L.",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"asociada",representative:""},{code:"824",entity:"CREDECOOP",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"825",entity:"COOPESAN RAMON",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"827",entity:"COOPEBANPO",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"829",entity:"COOPEAMISTAD",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"831",entity:"COOPEGRECIA",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"832",entity:"COOPAVEGRA",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"833",entity:"COOPEUNA",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"834",entity:"COOPEANDE No. 7 R.L.",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"835",entity:"COOPESPARTA R.L.",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"},{code:"836",entity:"COOPEASERRI R.L.",category:"COOPERATIVA DE AHORRO Y PRESTAMO",participation:"representada",representative:"COOPENAE"}];var p=o.map(e=>e.code),O=new Error("Type Error: expected string"),d=new Error("Format Error: invalid Costa Rica IBAN format"),i=e=>{if(typeof e!="string")throw O},n=e=>(i(e),e.slice(0,2)),D=e=>(i(e),n(e)==="CR"),T=e=>(i(e),e.length===22),E=e=>(i(e),/^CR\d\d0(1|[3-8])\d{16}$/.test(e)&&p.indexOf(e.slice(5,8))>-1),C=e=>{if(!E(e))throw d},c=e=>(C(e),e.slice(5,8)),r=e=>{let a=c(e),t=p.indexOf(a);return o[t]},R=(e,a=!1)=>{let t=r(e);return a&&t.participation==="representada"?t.representative:t.entity},I=(e,a=!1)=>r(e).category,y=class{constructor(a){this.getVersion=()=>A;C(a),this.iban=a}getCountryPrefix(){return n(this.iban)}getBankCode(){return c(this.iban)}getBankObject(){return r(this.iban)}getBankName(){return R(this.iban)}getBankCategory(){return I(this.iban)}},v=y;return B;})(); +'undefined'!=typeof module&&(module.exports=CostaRicaIBAN.default),'undefined'!=typeof window&&(CostaRicaIBAN=CostaRicaIBAN.default); \ No newline at end of file diff --git a/dist/costa-rica-iban.min.js.map b/dist/costa-rica-iban.min.js.map deleted file mode 100644 index b69f314..0000000 --- a/dist/costa-rica-iban.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://costa-rica-iban/webpack/universalModuleDefinition","webpack://costa-rica-iban/webpack/bootstrap","webpack://costa-rica-iban/./src/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","version","require","bankCollection","bankCodes","map","b","code","NOT_STRING_ERROR","Error","INVALID_IBAN_ERROR","errorIfNotString","varToverify","getCountryPrefixFromIBAN","iban","slice","verifyIBANCountryPrefix","verifyIBANLength","length","verifyIBANFormat","test","indexOf","errorOnInvalidIBAN","getBankCodeFromIBAN","getBankObjectFromIBAN","bankCode","bankIndex","getBankNameFromI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uB,IAGXC,EAAsB,SAACb,GAAuC,IAAjCc,EAAiC,wDACnEC,EAAaL,EAAsBV,GAEzC,OAAQc,GAAqD,iBAA7BC,EAAWC,cACzCD,EAAWE,eAEXF,EAAWG,QAITC,E,WAGJ,WAAYnB,I,4FAAM,uBAFX,MAEW,qBAsBL,kBAAMb,KArBjBqB,EAAmBR,GAEnBoB,KAAKpB,KAAOA,E,kEAIZ,OAAOD,EAAyBqB,KAAKpB,Q,oCAIrC,OAAOS,EAAoBW,KAAKpB,Q,sCAIhC,OAAOU,EAAsBU,KAAKpB,Q,oCAIlC,OAAOa,EAAoBO,KAAKpB,W,gCAMrBmB,a","file":"costa-rica-iban.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"costa-rica-iban\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"costa-rica-iban\"] = factory();\n\telse\n\t\troot[\"costa-rica-iban\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","const { version } = require('../package.json');\nconst bankCollection = require('./bank-collection.json');\n\nconst bankCodes = bankCollection.map((b) => b.code);\n\nconst NOT_STRING_ERROR = new Error('Type Error: expected string');\nconst INVALID_IBAN_ERROR = new Error('Format Error: invalid Costa Rica IBAN format');\n\nconst errorIfNotString = (varToverify) => {\n if (typeof varToverify !== 'string') {\n throw NOT_STRING_ERROR;\n }\n};\n\nexport const getCountryPrefixFromIBAN = (iban) => {\n errorIfNotString(iban);\n\n return iban.slice(0, 2);\n};\n\nexport const verifyIBANCountryPrefix = (iban) => {\n errorIfNotString(iban);\n\n return getCountryPrefixFromIBAN(iban) === 'CR';\n};\n\nexport const verifyIBANLength = (iban) => {\n errorIfNotString(iban);\n\n return iban.length === 22;\n};\n\nexport const verifyIBANFormat = (iban) => {\n errorIfNotString(iban);\n\n return (/^CR\\d\\d0(1|[3-8])\\d{16}$/).test(iban)\n && bankCodes.indexOf(iban.slice(5, 8)) > -1;\n};\n\nconst errorOnInvalidIBAN = (iban) => {\n if (!verifyIBANFormat(iban)) {\n throw INVALID_IBAN_ERROR;\n }\n};\n\nexport const getBankCodeFromIBAN = (iban) => {\n errorOnInvalidIBAN(iban);\n\n return iban.slice(5, 8);\n};\n\nexport const getBankObjectFromIBAN = (iban) => {\n const bankCode = getBankCodeFromIBAN(iban);\n const bankIndex = bankCodes.indexOf(bankCode);\n\n return bankCollection[bankIndex];\n};\n\nexport const getBankNameFromIBAN = (iban, returnRepresentative = false) => {\n const bankObject = getBankObjectFromIBAN(iban);\n\n return (returnRepresentative && bankObject.participation === 'representada') ? (\n bankObject.representative\n ) : (\n bankObject.entity\n );\n};\n\nclass CostaRicaIBAN {\n iban = null;\n\n constructor(iban) {\n errorOnInvalidIBAN(iban);\n\n this.iban = iban;\n }\n\n getCountryPrefix() {\n return getCountryPrefixFromIBAN(this.iban);\n }\n\n getBankCode() {\n return getBankCodeFromIBAN(this.iban);\n }\n\n getBankObject() {\n return getBankObjectFromIBAN(this.iban);\n }\n\n getBankName() {\n return getBankNameFromIBAN(this.iban);\n }\n\n getVersion = () => version;\n}\n\nexport default CostaRicaIBAN;\n"],"sourceRoot":""} \ No newline at end of file