├── .gitignore ├── src ├── index.js ├── Error │ └── index.js ├── Helper │ ├── helper.test.js │ └── index.js ├── Validator │ ├── validator.test.js │ └── index.js └── Geo │ ├── geo.test.js │ ├── index.js │ └── geo-data.js ├── index.js ├── webpack.config.js ├── package.json ├── LICENSE ├── .github └── workflows │ └── npmpublish.yml ├── index.d.ts ├── README.md ├── README-ES.md └── dist └── main.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const Geo = require("./Geo"); 2 | const Validator = require("./Validator"); 3 | 4 | module.exports = { 5 | Geo, 6 | Validator 7 | }; 8 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const Geo = require("./src/Geo"); 2 | const Validator = require("./src/Validator"); 3 | 4 | module.exports = { 5 | Geo, 6 | Validator, 7 | }; 8 | -------------------------------------------------------------------------------- /src/Error/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Error Handle for Util-Do errors 3 | * 4 | * @param {*} message 5 | * @param {*} type 6 | */ 7 | class UtilError extends Error { 8 | constructor(message) { 9 | super(message); 10 | this.name = "UtilDoPackageError"; 11 | } 12 | } 13 | 14 | module.exports = UtilError; 15 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const TerserPlugin = require("terser-webpack-plugin"); 3 | 4 | module.exports = { 5 | entry: { 6 | main: "./src/index.js" 7 | }, 8 | output: { 9 | filename: "main.js", 10 | path: path.resolve(__dirname, "dist"), 11 | libraryTarget: "commonjs2" 12 | }, 13 | optimization: { 14 | minimizer: [new TerserPlugin()] 15 | }, 16 | mode: "production" 17 | }; 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "utils-do", 3 | "version": "0.4.1", 4 | "description": "Small library to handler data source related to Dominican Republic", 5 | "main": "index.js", 6 | "typings": "index.d.ts", 7 | "types": "index.d.ts", 8 | "scripts": { 9 | "test": "jest", 10 | "build": "webpack" 11 | }, 12 | "keywords": [ 13 | "utils", 14 | "dominican", 15 | "geographic" 16 | ], 17 | "author": "Omar Gaston", 18 | "license": "MIT", 19 | "repository": { 20 | "type": "git", 21 | "url": "https://github.com/ogaston/utils-do.git" 22 | }, 23 | "dependencies": { 24 | "sdq": "^1.0.0" 25 | }, 26 | "homepage": "https://github.com/ogaston/utils-do", 27 | "devDependencies": { 28 | "babel-minify-webpack-plugin": "^0.3.1", 29 | "jest": "^24.9.0", 30 | "terser-webpack-plugin": "^1.4.5", 31 | "webpack": "^4.46.0", 32 | "webpack-cli": "^3.3.12" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Omar Gaston Chalas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/npmpublish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v1 16 | with: 17 | node-version: 12 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-npm: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-node@v1 27 | with: 28 | node-version: 12 29 | registry-url: https://registry.npmjs.org/ 30 | - run: npm ci 31 | - run: npm publish 32 | env: 33 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 34 | 35 | publish-gpr: 36 | needs: build 37 | runs-on: ubuntu-latest 38 | steps: 39 | - uses: actions/checkout@v2 40 | - uses: actions/setup-node@v1 41 | with: 42 | node-version: 12 43 | registry-url: https://npm.pkg.github.com/ 44 | scope: '@ogaston' 45 | - run: npm ci 46 | - run: npm publish 47 | env: 48 | NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 49 | -------------------------------------------------------------------------------- /src/Helper/helper.test.js: -------------------------------------------------------------------------------- 1 | const { _searchBy, _validateArgs, addConstant } = require("./index"); 2 | const UtilError = require("../Error"); 3 | 4 | describe("addConstant test", () => { 5 | test("should create and not modify a constant", () => { 6 | const newObj = {}; 7 | 8 | addConstant(newObj, "CONSTANT", 55); 9 | 10 | expect(newObj.hasOwnProperty("CONSTANT")).toBeTruthy(); 11 | expect(newObj.CONSTANT).toBe(55); 12 | newObj.CONSTANT = 100; 13 | expect(newObj.CONSTANT).toBe(55); 14 | }); 15 | }); 16 | 17 | describe("_searchBy test", () => { 18 | test("should search a value (case unsensitive) in array", () => { 19 | const newArr = ["Gastón", "Juan Carlos", "Chalas"]; 20 | const searchedValue = "gaston"; 21 | const wrongValue = "Oscar"; 22 | 23 | const result = _searchBy(newArr, searchedValue); 24 | const failedResult = _searchBy(newArr, wrongValue); 25 | expect(result).toBe("Gastón"); 26 | expect(failedResult).toBeUndefined(); 27 | }); 28 | }); 29 | 30 | describe("_validateArgs test", () => { 31 | test("should throw an error if the arguments is not as we expected", () => { 32 | const types = ["string", "number"]; 33 | 34 | expect(_validateArgs("Hello")).toBeUndefined(); 35 | expect(() => 36 | _validateArgs(undefined, undefined, undefined, true) 37 | ).toThrowError(UtilError); 38 | expect(() => 39 | _validateArgs("Romana", "the value must be string or number", types, true) 40 | ).not.toThrowError(UtilError); 41 | expect(() => 42 | _validateArgs(1, "the value must be string or number", types, true) 43 | ).not.toThrowError(UtilError); 44 | expect(() => 45 | _validateArgs(true, "the value must be string or number", types, false) 46 | ).not.toThrowError(UtilError); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /src/Helper/index.js: -------------------------------------------------------------------------------- 1 | const UtilError = require("../Error"); 2 | 3 | /** 4 | * Private - define a constant property 5 | * This function is not pure! 6 | * @param {Class | Object} obj 7 | * @param {string} key 8 | * @param {any} value 9 | * @returns Class | Object 10 | */ 11 | const addConstant = (obj, key, value) => { 12 | Object.defineProperty(obj, key, { 13 | enumerable: false, 14 | configurable: false, 15 | writable: false, 16 | value: value, 17 | }); 18 | return obj; 19 | }; 20 | 21 | /** 22 | * Private - Search in a source by the key no matter 23 | * if the parameter has or not accents mark 24 | * 25 | * @param {array} source 26 | * @param {string} parameter 27 | */ 28 | const _searchBy = (source = [], parameter) => { 29 | return source.find( 30 | (item) => 31 | item 32 | .normalize("NFD") 33 | .replace(/[\u0300-\u036f]/g, "") 34 | .toLowerCase() == 35 | parameter 36 | .normalize("NFD") 37 | .replace(/[\u0300-\u036f]/g, "") 38 | .toLowerCase() 39 | ); 40 | }; 41 | 42 | /** 43 | * Private - Return a handle function of the util error. if isStrict will throw the error, otherwise just show in the console. 44 | * 45 | * @param {boolean} isStrict 46 | * @param {UtilError} errObj 47 | */ 48 | const _execError = (isStrict, errObj) => { 49 | return isStrict 50 | ? () => { 51 | throw new UtilError(errObj); 52 | } 53 | : () => { 54 | console.error(errObj); 55 | }; 56 | }; 57 | 58 | /** 59 | * Private - validate the argument and if it fail throw an UtilError 60 | * @param {any} arg 61 | */ 62 | const _validateArgs = (arg, errMsg, types = [], isStrict = false) => { 63 | const _errMsg = errMsg || "the value argument is required and must be string"; 64 | const execErr = _execError(isStrict, _errMsg); 65 | if (!types.length) { 66 | if (typeof arg !== "string") execErr(); 67 | } else { 68 | if (!types.filter((t) => typeof arg == t).length) { 69 | execErr(); 70 | } 71 | } 72 | }; 73 | 74 | module.exports = { 75 | _validateArgs, 76 | _searchBy, 77 | addConstant, 78 | }; 79 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | type MunicipalDisctric = string; 2 | type Municipality = Record; 3 | type ProvinceSearchResult = { province: Province; municipality: string }; 4 | type RegionSeachResult = Record; 5 | 6 | interface UtilsDO { 7 | Geo: Geo; 8 | Validator: Validator; 9 | } 10 | 11 | declare const UtilsDo: UtilsDO; 12 | 13 | export const Geo: Geo; 14 | export const Validator: Validator; 15 | 16 | export default UtilsDo; 17 | 18 | class Geo { 19 | public readonly numberOfProvinces: number; 20 | public readonly numberOfMunicipalities: number; 21 | public readonly numberOfMunicipalDistrict: number; 22 | 23 | getProvinces(): Province[]; 24 | getMunicipalitiesOf(provincesName: Province): Municipality | undefined; 25 | getMunicipalDistrictOf( 26 | province: Province, 27 | municipality: string 28 | ): MunicipalDisctric[] | undefined; 29 | getProvinceByMunicipality(municipality: string): Province | undefined; 30 | getProvinceByMunicipalDistrict( 31 | municipalDisctric: string 32 | ): ProvinceSearchResult[] | undefined; 33 | getRegions(): string; 34 | getRegionsAndZones(): RegionSeachResult[]; 35 | getProvincesByRegion(region: string): string | undefined; 36 | getProvincesByZone(zone: string): string | undefined; 37 | } 38 | 39 | class Validator { 40 | setStrictValidation(value: boolean): void; 41 | 42 | isAnIde(id: string | number): boolean; 43 | formatToIde(id: string | number): string; 44 | 45 | isATel(tel: string | number): boolean; 46 | formatToTel(tel: string | number): string; 47 | 48 | isRNC(input: string | number): boolean; 49 | formatToRNC(rnc: string | number): string; 50 | } 51 | 52 | type Region = "Cibao" | "Sur" | "Este"; 53 | 54 | type Province = 55 | | "Azua" 56 | | "Bahoruco" 57 | | "Barahona" 58 | | "Dajabón" 59 | | "Duarte" 60 | | "El Seibo" 61 | | "Elías Piña" 62 | | "Espaillat" 63 | | "Hato Mayor" 64 | | "Hermanas Mirabal" 65 | | "Independencia" 66 | | "La Altagracia" 67 | | "La Romana" 68 | | "La Vega" 69 | | "María Trinidad Sánchez" 70 | | "Monseñor Nouel" 71 | | "Montecristi" 72 | | "Monte Plata" 73 | | "Pedernales" 74 | | "Peravia" 75 | | "Puerto Plata" 76 | | "Samamá" 77 | | "San Cristóbal"; 78 | -------------------------------------------------------------------------------- /src/Validator/validator.test.js: -------------------------------------------------------------------------------- 1 | const Validator = require("./index"); 2 | const UtilError = require("../Error"); 3 | 4 | describe("Validator IDE test", () => { 5 | test("isAnIde should be true if is a valid Dominicans Id", () => { 6 | Validator.setStrictValidation(true); 7 | expect(Validator.isAnIde).toThrowError(UtilError); 8 | expect(Validator.isAnIde(40240953303)).toBeTruthy(); 9 | expect(Validator.isAnIde("402-7777777-7")).toBeFalsy(); 10 | expect(Validator.isAnIde("00112851662")).toBeTruthy(); 11 | }); 12 | 13 | test("formatToIde should return a string with as a formated id, if it cant return undefined.", () => { 14 | Validator.setStrictValidation(true); 15 | expect(Validator.formatToIde).toThrowError(UtilError); 16 | expect(Validator.formatToIde("40258789789784")).toBeUndefined(); 17 | expect(Validator.formatToIde(40240953303)).toEqual("402-4095330-3"); 18 | expect(Validator.formatToIde("402-40953303")).toEqual("402-4095330-3"); 19 | expect(Validator.formatToIde("00112851662")).toEqual("001-1285166-2"); 20 | }); 21 | }); 22 | 23 | describe("Validator Telephone test", () => { 24 | test("isATel should be true if is a valid Dominicans tel number", () => { 25 | Validator.setStrictValidation(true); 26 | expect(Validator.isATel).toThrowError(UtilError); 27 | expect(Validator.isATel("80954888889")).toBeFalsy(); 28 | expect(Validator.isATel(8095564125)).toBeTruthy(); 29 | expect(Validator.isATel("829-556-4125")).toBeTruthy(); 30 | expect(Validator.isATel("8495564125")).toBeTruthy(); 31 | expect(Validator.isATel("85954888889")).toBeFalsy(); 32 | }); 33 | 34 | test("formatToTel should return a string with as a formated tel number, if it cant return undefined.", () => { 35 | Validator.setStrictValidation(true); 36 | expect(Validator.formatToTel).toThrowError(UtilError); 37 | expect(Validator.formatToTel("8008095564128")).toBeUndefined(); 38 | expect(Validator.formatToTel(8095564125)).toEqual("(809) 556-4125"); 39 | expect(Validator.formatToTel("829-5564125")).toEqual("(829) 556-4125"); 40 | expect(Validator.formatToTel("8495564125")).toEqual("(849) 556-4125"); 41 | }); 42 | }); 43 | 44 | describe("Rnc test", () => { 45 | test("isRNC should be true if is a valid Dominicans RNC number", () => { 46 | expect(Validator.isRNC("1010277978")).toBeFalsy(); 47 | expect(Validator.isRNC("101027797")).toBeTruthy(); 48 | expect(Validator.isRNC(101027797)).toBeTruthy(); 49 | expect(Validator.isRNC("101-65638-7")).toBeTruthy(); 50 | }); 51 | 52 | test("isRNC should return a string with as a formated RNC, if it cant return undefined", () => { 53 | expect(Validator.formatToRNC("1010277978")).toBeUndefined(); 54 | expect(Validator.formatToRNC("101027797")).toEqual("101-02779-7"); 55 | expect(Validator.formatToRNC(101027797)).toEqual("101-02779-7"); 56 | expect(Validator.formatToRNC("101-65638-7")).toEqual("101-65638-7"); 57 | }); 58 | }); 59 | -------------------------------------------------------------------------------- /src/Geo/geo.test.js: -------------------------------------------------------------------------------- 1 | const Geo = require("./index"); 2 | 3 | describe("Provinces methods test", () => { 4 | test("getProvinces: Should return an array with the provinces", () => { 5 | const provinces = Geo.getProvinces(); 6 | expect(provinces instanceof Array).toBeTruthy(); 7 | expect(provinces.length).not.toBe(0); 8 | expect(provinces).toHaveLength(Geo.numberOfProvinces); 9 | }); 10 | 11 | test("getMunicipalitiesOf: Should return an object with the municipalities", () => { 12 | const municipalities = Geo.getMunicipalitiesOf("la romana"); 13 | expect(municipalities.hasOwnProperty("Villa Hermosa")).toBeTruthy(); 14 | expect(municipalities["La Romana"]).toEqual( 15 | expect.arrayContaining(["Caleta"]) 16 | ); 17 | 18 | const samanaMunicipalities = Geo.getMunicipalitiesOf("samana"); 19 | expect(samanaMunicipalities.hasOwnProperty("Samaná")).toBeTruthy(); 20 | }); 21 | 22 | test("getMunicipalDistrictOf: Should return an array with the municipals disctric", () => { 23 | const munDisctrict = Geo.getMunicipalDistrictOf( 24 | "la altagracia", 25 | "San Rafael del Yuma" 26 | ); 27 | expect(munDisctrict instanceof Array).toBeTruthy(); 28 | expect(munDisctrict).toEqual(expect.arrayContaining(["Bayahibe"])); 29 | }); 30 | 31 | test("getProvinceByMunicipalDistrict: Should return an array with an object with the provinces and its municipalities", () => { 32 | const provinces = Geo.getProvinceByMunicipalDistrict("cabarete"); 33 | expect(provinces instanceof Array).toBeTruthy(); 34 | expect(provinces[0].province).toBe("Puerto Plata"); 35 | expect(provinces[0].municipality).toBe("Sosúa"); 36 | }); 37 | 38 | test("getProvinceByMunicipality: Should return an array with the provinces", () => { 39 | const provinces = Geo.getProvinceByMunicipality("sanchez"); 40 | expect(provinces instanceof Array).toBeTruthy(); 41 | expect(provinces).toEqual(expect.arrayContaining(["Samaná"])); 42 | }); 43 | }); 44 | 45 | describe("Regions methods test", () => { 46 | test("getRegions: Should return an array with the provinces of a region", () => { 47 | const regions = Geo.getRegions(); 48 | expect(regions instanceof Array).toBeTruthy(); 49 | expect(regions).toEqual(expect.arrayContaining(["Cibao", "Este", "Sur"])); 50 | }); 51 | 52 | test("getRegionsAndZones: Should return an array with the provinces of a region", () => { 53 | const regions = Geo.getRegionsAndZones(); 54 | expect(regions instanceof Array).toBeTruthy(); 55 | expect(regions).toHaveLength(3); 56 | expect(regions.some((v) => v.region === "Este")).toBeTruthy(); 57 | }); 58 | 59 | test("getProvincesByRegion: Should return an array with the provinces of a region", () => { 60 | const provinces = Geo.getProvincesByRegion("este"); 61 | expect(provinces instanceof Array).toBeTruthy(); 62 | expect(provinces).toEqual( 63 | expect.arrayContaining([ 64 | "La Romana", 65 | "La Altagracia", 66 | "San Pedro de Macorís", 67 | ]) 68 | ); 69 | }); 70 | 71 | test("getProvincesByZone: Should return an array with the provinces of a region", () => { 72 | const provinces = Geo.getProvincesByZone("cibao sur"); 73 | expect(provinces instanceof Array).toBeTruthy(); 74 | expect(provinces).toEqual( 75 | expect.arrayContaining(["La Vega", "Monseñor Nouel"]) 76 | ); 77 | }); 78 | }); 79 | -------------------------------------------------------------------------------- /src/Validator/index.js: -------------------------------------------------------------------------------- 1 | const { isRnc } = require("sdq"); 2 | const { _searchBy, _validateArgs, addConstant } = require("../Helper/index"); 3 | 4 | let strictValidation = false; 5 | 6 | class Validator { 7 | /** 8 | * Set strict mode for params types of the methods 9 | * 10 | * @param {boolean} value 11 | */ 12 | setStrictValidation(value) { 13 | strictValidation = value; 14 | } 15 | 16 | /** 17 | * Validate if the value inserted is a valid dominican id. 18 | * 19 | * @param {string | number} id 20 | * @returns { boolean } 21 | */ 22 | isAnIde(id) { 23 | _validateArgs( 24 | id, 25 | "the value should be string or number", 26 | ["string", "number"], 27 | strictValidation 28 | ); 29 | return v_id(id); 30 | } 31 | 32 | /** 33 | * Return the value formatted as a dominican id. 34 | * 35 | * @param {string | number} id 36 | */ 37 | formatToIde(id) { 38 | const errMsg = "The value should be string or number"; 39 | _validateArgs(id, errMsg, ["string", "number"], strictValidation); 40 | const regex = /\(?(\d{3})\)?[- ]?(\d{7})[- ]?(\d{1})/g; 41 | const result = ("" + id).replace(regex, "$1-$2-$3"); 42 | return result.length === 13 ? result : undefined; 43 | } 44 | 45 | /** 46 | * Validate if the value inserted is a valid dominican telephone. 47 | * 48 | * @param {string | number} tel 49 | * @returns { boolean } 50 | */ 51 | isATel(tel) { 52 | _validateArgs( 53 | tel, 54 | "the value should be string or number", 55 | ["string", "number"], 56 | strictValidation 57 | ); 58 | const regexResult = ("" + tel).match(/\d+/gi); 59 | const numericTel = Array.isArray(regexResult) 60 | ? regexResult.join("").match(/^8[0-4]9\d{3}\d{4}$/) 61 | : null; 62 | return numericTel !== null; 63 | } 64 | 65 | /** 66 | * Return the value formatted as a dominican tel number. 67 | * 68 | * @param {string | number} id 69 | */ 70 | formatToTel(tel) { 71 | const errMsg = "the value should be string or number"; 72 | _validateArgs(tel, errMsg, ["string", "number"], strictValidation); 73 | const regex = /\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})/g; 74 | const result = ("" + tel).replace(regex, "($1) $2-$3"); 75 | return result.length === 14 ? result : undefined; 76 | } 77 | 78 | /** 79 | * Validate if is a valid RNC 80 | * 81 | * @param {string | number} input 82 | */ 83 | isRNC(input) { 84 | return isRnc("" + input); 85 | } 86 | 87 | /** 88 | * Return the value formatted as a dominican RNC. 89 | * 90 | * @param {string | number} id 91 | */ 92 | formatToRNC(rnc) { 93 | const errMsg = "the value should be string or number"; 94 | _validateArgs(rnc, errMsg, ["string", "number"], strictValidation); 95 | if (this.isRNC(rnc)) { 96 | const regex = /\(?(\d{3})\)?[- ]?(\d{5})[- ]?(\d{1})/g; 97 | return ("" + rnc).replace(regex, "$1-$2-$3"); 98 | } 99 | return undefined; 100 | } 101 | } 102 | 103 | module.exports = new Validator(); 104 | 105 | /** 106 | * Validation algorithm 107 | * 108 | * @param {string | number } cid 109 | */ 110 | function v_id(cid) { 111 | function g__rd(bn) { 112 | for (let u = bn; u < bn + 10; u++) { 113 | if (u % 10 === 0) return u; 114 | } 115 | } 116 | 117 | const _c = String(cid).replace(/\D/g, ""); 118 | let sc = ""; 119 | 120 | for (let i = 0; i < 10; i++) { 121 | const v = Number(_c[i]); 122 | const m = i % 2; 123 | const clc = m === 0 ? 1 * v : 2 * v; 124 | sc = sc += clc.toString(); 125 | } 126 | 127 | const cAr = sc.split(""); 128 | const sm = cAr.reduce((t, n) => +t + Number(n)); 129 | 130 | const nd = g__rd(sm); 131 | 132 | const vd = nd - sm; 133 | const ld = +_c[10]; 134 | return vd === ld; 135 | } 136 | -------------------------------------------------------------------------------- /src/Geo/index.js: -------------------------------------------------------------------------------- 1 | const { provinces, regions } = require("./geo-data"); 2 | const { _searchBy, _validateArgs, addConstant } = require("../Helper/index") 3 | 4 | 5 | /** 6 | * Class related to geographical locations 7 | */ 8 | class Geo { 9 | /** 10 | * Return an array of string with the name of each province 11 | * @returns {string[]} provinces 12 | */ 13 | getProvinces() { 14 | return Object.keys(provinces); 15 | } 16 | 17 | /** 18 | * Search an return an object with the municipalities of a province as properties 19 | * @param {string} provincesName 20 | * @returns {object | undefined} 21 | */ 22 | getMunicipalitiesOf(provincesName) { 23 | _validateArgs(provincesName) 24 | const provinceFounded = _searchBy(this.getProvinces(), provincesName) 25 | if (provinceFounded) { 26 | return provinces[provinceFounded].municipality; 27 | } 28 | return undefined; 29 | } 30 | 31 | /** 32 | * Return the municipals district of a municipality of a province. 33 | * 34 | * @param {string} province 35 | * @param {string} municipality 36 | * @returns {string[] | undefined} 37 | */ 38 | getMunicipalDistrictOf(province, municipality) { 39 | _validateArgs(province) 40 | const proFounded = this.getMunicipalitiesOf(province) 41 | if (proFounded) { 42 | const munFounded = _searchBy(Object.keys(proFounded), municipality); 43 | if (munFounded) { 44 | return proFounded[munFounded] 45 | } 46 | return undefined 47 | } 48 | return undefined; 49 | } 50 | 51 | 52 | /** 53 | * Get the name of the provices where the municipality belong to 54 | * 55 | * It return an array because the name of the municipality might be in two or more provinces 56 | * 57 | * @param {string} municipality 58 | * @return {string[]} 59 | */ 60 | getProvinceByMunicipality(municipality) { 61 | _validateArgs(municipality) 62 | return this.getProvinces().filter(province => { 63 | const sourceForSearch = Object.keys(provinces[province].municipality) 64 | return _searchBy(sourceForSearch, municipality); 65 | }) 66 | } 67 | 68 | 69 | /** 70 | * Get an object with the province and the municipality searched for the municipal district 71 | * 72 | * @param {string} municipalDisctric 73 | * @return {{province: string, municipality: string}[]} 74 | */ 75 | getProvinceByMunicipalDistrict(municipalDisctric) { 76 | _validateArgs(municipalDisctric) 77 | return this.getProvinces().map(province => { 78 | const _mun = provinces[province].municipality; 79 | const _munKeys = Object.keys(_mun) 80 | const founded = _munKeys.filter(k => { 81 | return _searchBy(_mun[k], municipalDisctric) 82 | }) 83 | return founded.length ? { 84 | province: province, municipality: founded[0] 85 | }: false; 86 | }).filter(v => v) 87 | } 88 | 89 | /** 90 | * Get the macro-regions of the country 91 | * @returns { string[] } 92 | */ 93 | getRegions() { 94 | return Object.keys(regions).map(k => regions[k].name) 95 | } 96 | 97 | /** 98 | * Get an object with each region with their respective zones 99 | * @returns { { [region]: string[] }[] } 100 | */ 101 | getRegionsAndZones() { 102 | return Object.keys(regions).map(k => { 103 | const zones = 104 | Object 105 | .keys(regions[k]) 106 | .map(_k => regions[k][_k].name) 107 | .filter(v => v); 108 | return { 109 | region: regions[k].name, 110 | zones 111 | } 112 | }) 113 | } 114 | 115 | /** 116 | * Get the provinces which belong to a region 117 | * 118 | * @param {string} region 119 | * @returns {string[]} 120 | */ 121 | getProvincesByRegion(region) { 122 | _validateArgs(region) 123 | return this.getProvinces().filter(p => { 124 | return provinces[p].region.name.toLowerCase() === region.toLowerCase() 125 | }) 126 | } 127 | 128 | /** 129 | * Get the provinces which belong to a zone 130 | * 131 | * @param {string} zone 132 | * @returns {string[]} 133 | */ 134 | getProvincesByZone(zone) { 135 | _validateArgs(zone) 136 | return this.getProvinces().filter(p => { 137 | return provinces[p].region.zone.toLowerCase() === zone.toLowerCase() 138 | }) 139 | } 140 | } 141 | 142 | addConstant(Geo.prototype, "numberOfProvinces", 31); 143 | addConstant(Geo.prototype, "numberOfMunicipalities", 158); 144 | addConstant(Geo.prototype, "numberOfMunicipalDistrict", 231); 145 | 146 | module.exports = new Geo; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > **Utils-DO is currently in beta.** Expect more bugs than a final release. 2 | 3 | [Leer en Español](https://github.com/ogaston/utils-do/blob/master/README-ES.md) 4 | 5 | ## Documentation 6 | 7 | 🚀 Get started [ Documentations in progress ] 8 | 9 | The Utils-DO, This small library is a handler and data source related to Dominican Republic. 10 | 11 | **We have Typescript Support now** 12 | 13 | ## Installation 14 | 15 | ```bash 16 | 17 | $ npm i utils-do --save 18 | 19 | ``` 20 | 21 | ## Geo 22 | 23 | This class is used as a source of geographic information of the country. 24 | 25 | ```javascript 26 | const { Geo } = require("utils-do"); 27 | 28 | const result = Geo.getProvincesByZone("cibao sur"); 29 | 30 | console.log(result); // [ 'La Vega', 'Monseñor Nouel', 'Sánchez Ramírez' ] 31 | ``` 32 | 33 | > This method retrieve an array of the provinces located in that zone (sub-region) 34 | 35 | ### API Reference 36 | 37 | | Method | Description | Return | 38 | | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | 39 | | `getProvinces()` | Return an array of string with the name of each province | string[] | 40 | | `getMunicipalitiesOf(provincesName)` | Search an return an object with the municipalities of a province as properties | object or undefined | 41 | | `getMunicipalDistrictOf(province, municipality)` | Return the municipals district of a municipality of a province. | string[] or undefined | 42 | | `getProvinceByMunicipality(municipality)` | Get the name of the provices where the municipality belong to. It return an array because the name of the municipality might be in two or more provinces. | string[] | 43 | | `getProvinceByMunicipalDistrict(municipalDisctric)` | Get an object with the province and the municipality searched for the municipal district. | {province: string, municipality: string}[] | 44 | | `getRegions()` | Get the macro-regions of the country. | string[] | 45 | | `getRegionsAndZones()` | Get an object with each region with their respective zones. | { [region]: string[] }[] | 46 | | `getProvincesByRegion(region)` | Get the provinces which belong to a region. | string[] | 47 | | `getProvincesByZone()` | Get the provinces which belong to a zone. | string[] | 48 | 49 | ## Validator 50 | 51 | This class is used to handle and validate generic data like the _IDE_ (Citizen identification or 'Cedula'). 52 | 53 | ```javascript 54 | const { Validator } = require("utils-do"); 55 | 56 | const result = Validator.isAnIde("4022222222"); 57 | 58 | console.log(result); // true 59 | 60 | Validator.formatToIde(4022222222); // "402-2222222-2" 61 | ``` 62 | 63 | > These methods are used to handle the ID of the dominicans. 64 | 65 | ### API Reference 66 | 67 | | Method | Description | Return | 68 | | ------------------ | --------------------------------------------------------------- | ------------------- | 69 | | `isAnIde(id)` | Validate if the value inserted is a valid dominican id | boolean | 70 | | `formatToIde(id)` | Return the value formatted as a dominican id. | string or undefined | 71 | | `isATel(tel)` | Return the municipals district of a municipality of a province. | boolean | 72 | | `formatToTel(tel)` | Return the value formatted as a dominican tel number. | string or undefined | 73 | | `isRNC(input)` | Validate if is a valid RNC. | boolean | 74 | | `formatToRNC(rnc)` | Return the value formatted as a dominican RNC. | string or undefined | 75 | 76 | ## Contributing 77 | 78 | Contact me for help on growing up the repo, building and testing. 79 | 80 | Please make your open a new issue / make your pull-request or [send me an email](mailto:omar.gaston.c@gmail.com). 81 | 82 | ## Thanks 83 | 84 | We would like to thank to anyone who use or contribute this repo. 85 | 86 | ## License 87 | 88 | This project uses the following license: [MIT]() 89 | -------------------------------------------------------------------------------- /README-ES.md: -------------------------------------------------------------------------------- 1 | > **Utils-DO esta actualmente en beta.** Espera más errores que una versión final. 2 | 3 | [Read in English](https://github.com/ogaston/utils-do/blob/master/README.md) 4 | 5 | ## Documentación 6 | 7 | 🚀 Inicio [Documentaciones en curso] 8 | 9 | Utils-DO, esta pequeña librería es un manejador y fuentes de datos relacionados con República Dominicana. 10 | 11 | **Ahora adaptado para TypeScript** 12 | 13 | ## Instalación 14 | 15 | ```bash 16 | 17 | $ npm i utils-do --save 18 | 19 | ``` 20 | 21 | ## Geo 22 | 23 | Esta clase se utiliza como fuente de información geográfica del país. 24 | 25 | ```javascript 26 | const { Geo } = require("utils-do"); 27 | 28 | const result = Geo.getProvincesByZone("cibao sur"); 29 | 30 | console.log(result); // [ 'La Vega', 'Monseñor Nouel', 'Sánchez Ramírez' ] 31 | ``` 32 | 33 | > Este método recupera una matriz de las provincias ubicadas en esa zona (subregión) 34 | 35 | ### Referencia de la API 36 | 37 | | Método | Descripción | Devuelve | 38 | | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | 39 | | `getProvinces()` | Devuelve una matriz de strings con el nombre de cada provincia | string[] | 40 | | `getMunicipalitiesOf(provincesName)` | Buscar una devolución de un objeto con los municipios de una provincia como propiedades | objeto o undefined | 41 | | `getMunicipalDistrictOf(provincia, municipio)` | Devolver el distrito municipal de un municipio de una provincia | string[] o undefined | 42 | | `getProvinceByMunicipality(municipio)` | Obtenga el nombre de las provincias a las que pertenece el municipio. Devuelve una matriz porque el nombre del municipio podría estar en dos o más provincias | string[] | 43 | | `getProvinceByMunicipalDistrict(municipalDisctric)` | Obtenga un objeto con la provincia y el municipio buscado por el distrito municipal | {provincia: string, municipio: string}[] | 44 | | `getRegions()` | Obtenga las macrorregiones del país | string[] | 45 | | `getRegionsAndZones()` | Obtenga un objeto con cada región con sus respectivas zonas | {[región]: string[]}[] | 46 | | `getProvincesByRegion(región)` | Obtenga las provincias que pertenecen a una región | string[] | 47 | | `getProvincesByZone()` | Obtenga las provincias que pertenecen a una zona | string[] | 48 | 49 | ## Validator 50 | 51 | Esta clase se utiliza para manejar la validación de datos genéricos como el ID (identificación del ciudadano o 'Cedula'). 52 | 53 | ```javascript 54 | const { Validator } = require("utils-do"); 55 | 56 | const result = Validator.isAnIde("4022222222"); 57 | 58 | console.log(result); // true 59 | 60 | Validator.formatToIde(4022222222); // "402-2222222-2" 61 | ``` 62 | 63 | > Estos métodos se utilizan para manejar la identificación de los dominicanos. 64 | 65 | ### Referencia de API 66 | 67 | | Método | Descripción | Devuelve | 68 | | ------------------ | --------------------------------------------------------------------- | ------------------ | 69 | | `isAnIde(id)` | Validar si el valor insertado es una identificación dominicana válida | booleano | 70 | | `formatToIde(id)` | Devuelve el valor formateado como una identificación dominicana. | string o undefined | 71 | | `isATel(tel)` | Devolver el distrito municipal de un municipio de una provincia. | booleano | 72 | | `formatToTel(tel)` | Devuelve el valor formateado como un número de teléfono dominicano. | string o undefined | 73 | | `isRNC(entrada)` | Valide si es un RNC válido. | booleano | 74 | | `formatToRNC(rnc)` | Devuelve el valor formateado como un RNC dominicano. | string o undefined | 75 | 76 | ## Contribuyendo 77 | 78 | Para ayuda en crecer el repositorio, construir y probar. 79 | 80 | Por favor, haga un nuevo issue / haga su pull-request o [enviame un correo electrónico](mailto:omar.gaston.c@gmail.com). 81 | 82 | ## Agradecimientos 83 | 84 | Quisiéramos agradecer a cualquiera que use o contribuya con este repositorio. 85 | 86 | ## Licencia 87 | 88 | Este proyecto utiliza la siguiente licencia: [MIT]() 89 | -------------------------------------------------------------------------------- /dist/main.js: -------------------------------------------------------------------------------- 1 | module.exports=function(a){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return a[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=a,n.c=e,n.d=function(a,e,o){n.o(a,e)||Object.defineProperty(a,e,{enumerable:!0,get:o})},n.r=function(a){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},n.t=function(a,e){if(1&e&&(a=n(a)),8&e)return a;if(4&e&&"object"==typeof a&&a&&a.__esModule)return a;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:a}),2&e&&"string"!=typeof a)for(var i in a)n.d(o,i,function(e){return a[e]}.bind(null,i));return o},n.n=function(a){var e=a&&a.__esModule?function(){return a.default}:function(){return a};return n.d(e,"a",e),e},n.o=function(a,e){return Object.prototype.hasOwnProperty.call(a,e)},n.p="",n(n.s=1)}([function(a,e,n){const o=n(4);a.exports={_validateArgs:(a,e,n=[],i=!1)=>{const r=((a,e)=>a?()=>{throw new o(e)}:()=>{console.error(e)})(i,e||"the value argument is required and must be string");n.length?n.filter(e=>typeof a==e).length||r():"string"!=typeof a&&r()},_searchBy:(a=[],e)=>a.find(a=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()==e.toLowerCase()),addConstant:(a,e,n)=>(Object.defineProperty(a,e,{enumerable:!1,configurable:!1,writable:!1,value:n}),a)}},function(a,e,n){const o=n(2),i=n(5);a.exports={Geo:o,Validator:i}},function(a,e,n){const{provinces:o,regions:i}=n(3),{_searchBy:r,_validateArgs:t,addConstant:l}=n(0);class s{getProvinces(){return Object.keys(o)}getMunicipalitiesOf(a){t(a);const e=r(this.getProvinces(),a);if(e)return o[e].municipality}getMunicipalDistrictOf(a,e){t(a);const n=this.getMunicipalitiesOf(a);if(n){const a=r(Object.keys(n),e);return a?n[a]:void 0}}getProvinceByMunicipality(a){return t(a),this.getProvinces().filter(e=>{const n=Object.keys(o[e].municipality);return r(n,a)})}getProvinceByMunicipalDistrict(a){return t(a),this.getProvinces().map(e=>{const n=o[e].municipality,i=Object.keys(n).filter(e=>r(n[e],a));return!!i.length&&{province:e,municipality:i[0]}}).filter(a=>a)}getRegions(){return Object.keys(i).map(a=>i[a].name)}getRegionsAndZones(){return Object.keys(i).map(a=>{const e=Object.keys(i[a]).map(e=>i[a][e].name).filter(a=>a);return{region:i[a].name,zones:e}})}getProvincesByRegion(a){return t(a),this.getProvinces().filter(e=>o[e].region.name.toLowerCase()===a.toLowerCase())}getProvincesByZone(a){return t(a),this.getProvinces().filter(e=>o[e].region.zone.toLowerCase()===a.toLowerCase())}}l(s.prototype,"numberOfProvinces",31),l(s.prototype,"numberOfMunicipalities",158),l(s.prototype,"numberOfMunicipalDistrict",231),a.exports=new s},function(a,e){const n={cibao:{name:"Cibao",norte:{id:1,name:"Cibao Norte"},sur:{id:2,name:"Cibao Sur"},nordeste:{id:3,name:"Cibao Nordeste"},noroeste:{id:4,name:"Cibao Noroeste"}},sur:{name:"Sur",valdesia:{id:5,name:"Valdesia"},elValle:{id:6,name:"El Valle"},enriquillo:{id:7,name:"Enriquillo"}},este:{name:"Este",yuma:{id:8,name:"Yuma"},higuamo:{id:9,name:"Higuamo"},ozama:{id:10,name:"Ozama"}}},o={Azua:{region:{id:n.sur.valdesia.id,name:n.sur.name,zone:n.sur.valdesia.name},municipality:{"Azua de Compostela":["Barreras","Barro Arriba","Clavellina","Emma Balaguer Viuda Vallejo","Las Barías-La Estancia","Las Lomas","Los Jovillos","Puerto Viejo"],"Estebanía":[],Guayabal:[],"Las Charcas":["Hatillo","Palmar de Ocoa"],"Las Yayas de Viajama":["Villarpando","Hato Nuevo-Cortés"],"Padre Las Casas":["La Siembra","Las Lagunas","Los Fríos"],Peralta:[],"Pueblo Viejo":["El Rosario"],"Sabana Yegua":["Proyecto 4","Ganadero","Proyecto 2-C"],"Tábara Arriba":["Amiama Gómez","Los Toros","Tábara Abajo"]}},Bahoruco:{region:{id:n.sur.enriquillo.id,name:n.sur.name,zone:n.sur.enriquillo.name},municipality:{Neiba:["El Palmar"],"Galván":["El Salado"],"Los Ríos":["Las Clavellinas"],Tamayo:["Cabeza de Toro","Mena","Monserrat","Santa Bárbara-El 6 ","Santana ","Uvilla"]}},Barahona:{region:{id:n.sur.enriquillo.id,name:n.sur.name,zone:n.sur.enriquillo.name},municipality:{Barahona:["El Cachón","La Guázara","Villa Central"],Cabral:[],"El Peñón":[],Enriquillo:["Arroyo Dulce"],"Fundación":["Pescadería"],Jaquimeyes:["Palo Alto"],"La Ciénaga":["Bahoruco"],"Las Salinas":[],"Paraíso":["Los Patos"],Polo:[],"Vicente Noble":["Canoa","Fondo Negro","Quita Coraza"]}},"Dajabón":{region:{id:n.cibao.noroeste.id,name:n.cibao.name,zone:n.cibao.noroeste.name},municipality:{"Dajabón":["Cañongo"],"El Pino":["Manuel Bueno"],"Loma de Cabrera":["Capotillo","Santiago de la Cruz"],Partido:[],"Restauración":[]}},Duarte:{region:{id:n.cibao.nordeste.id,name:n.cibao.name,zone:n.cibao.nordeste.name},municipality:{"San Francisco de Macorís":["Cenoví","Jaya","La Peña","Presidente Don Antonio Guzmán Fernández"],Arenoso:["El Aguacate","Los Coles"],Castillo:[],"Eugenio María de Hostos":["Sabana Grande"],"Las Guáranas":[],Pimentel:[],"Villa Riva":["Agua Santa del Yuna","Barraquito","Cristo Rey de Guaraguao","Las Táranas"]}},"El Seibo":{region:{id:n.este.yuma.id,name:n.este.name,zone:n.este.yuma.name},municipality:{"El Seibo":["Pedro Sánchez","San Francisco-Vicentillo","Santa Lucía"],Miches:["El Cedro","La Gina"]}},"Elías Piña":{region:{id:n.sur.elValle.id,name:n.sur.name,zone:n.sur.elValle.name},municipality:{Comendador:["Guayabo","Sabana Larga"],"Bánica":["Sabana Cruz","Sabana Higuero"],"El Llano":["Guanito"],"Hondo Valle":["Rancho de la Guardia"],"Juan Santiago":[],"Pedro Santana":["Río Limpio"]}},Espaillat:{region:{id:n.cibao.norte.id,name:n.cibao.name,zone:n.cibao.norte.name},municipality:{Moca:["Canca La Reina","El Higüerito","José Contreras","Juan López","La Ortega","Las Lagunas","Monte de la Jagua","San Víctor"],"Cayetano Germosén":[],"Gaspar Hernández":["Joba Arriba","Veragua","Villa Magante"],"Jamao al Norte":[]}},"Hato Mayor":{region:{id:n.este.higuamo.id,name:n.este.name,zone:n.este.higuamo.name},municipality:{"Hato Mayor del Rey":["Guayabo Dulce","Mata Palacio","Yerba Buena"],"El Valle":[],"Sabana de la Mar":["Elupina Cordero de Las Cañitas"]}},"Hermanas Mirabal":{region:{id:n.cibao.nordeste.id,name:n.cibao.name,zone:n.cibao.nordeste.name},municipality:{Salcedo:["Jamao Afuera"],Tenares:["Blanco"],"Villa Tapia":[]}},Independencia:{region:{id:n.sur.enriquillo.id,name:n.sur.name,zone:n.sur.enriquillo.name},municipality:{"Jimaní":["Boca de Cachón","El Limón"],"Cristóbal":["El Batey 8"],"Duvergé":["Vengan a Ver"],"La Descubierta":[],Mella:["La Colonia"],"Postrer Río":["Guayabal"]}},"La Altagracia":{region:{id:n.este.yuma.id,name:n.este.name,zone:n.este.yuma.name},municipality:{"Higüey":["La Otra Banda","Lagunas de Nisibón","Verón-Punta Cana"],"San Rafael del Yuma":["Bayahibe","Boca de Yuma"]}},"La Romana":{region:{id:n.este.yuma.id,name:n.este.name,zone:n.este.yuma.name},municipality:{"La Romana":["Caleta"],Guaymate:[],"Villa Hermosa":["Cumayasa"]}},"La Vega":{region:{id:n.cibao.sur.id,name:n.cibao.name,zone:n.cibao.sur.name},municipality:{"La Concepción de La Vega":["El Ranchito","Río Verde Arriba"],Constanza:["La Sabina","Tireo"],Jarabacoa:["Buena Vista","Manabao"],"Jima Abajo":["Rincón"]}},"María Trinidad Sánchez":{region:{id:n.cibao.nordeste.id,name:n.cibao.name,zone:n.cibao.nordeste.name},municipality:{Nagua:["Arroyo al Medio ","Las Gordas ","San José de Matanzas"],Cabrera:["Arroyo Salado ","La Entrada"],"El Factor":["El Pozo"],"Río San Juan":[]}},"Monseñor Nouel":{region:{id:n.cibao.sur.id,name:n.cibao.name,zone:n.cibao.sur.name},municipality:{Bonao:["Arroyo Toro-Masipedro ","La Salvia-Los Quemados ","Jayaco ","Juma Bejucal ","Sabana del Puerto"],"Maimón":[],"Piedra Blanca":["Juan Adrián ","Villa Sonador"]}},Montecristi:{region:{id:n.cibao.noroeste.id,name:n.cibao.name,zone:n.cibao.noroeste.name},municipality:{Montecristi:[],"Castañuela":["Palo Verde"],"Guayubín":["Cana Chapetón ","Hatillo Palma ","Villa Elisa"],"Las Matas de Santa Cruz":[],"Pepillo Salcedo":[],"Villa Vásquez":[]}},"Monte Plata":{region:{id:n.este.higuamo.id,name:n.este.name,zone:n.este.higuamo.name},municipality:{"Monte Plata":["Boyá ","Chirino ","Don Juan"],Bayaguana:[],Peralvillo:[],"Sabana Grande de Boyá":["Gonzalo ","Majagual"],"Yamasá":["Los Botados"]}},Pedernales:{region:{id:n.sur.enriquillo.id,name:n.sur.name,zone:n.sur.enriquillo.name},municipality:{Pedernales:["José Francisco Peña Gómez ","Juancho"],Oviedo:[]}},Peravia:{region:{id:n.sur.valdesia.id,name:n.sur.name,zone:n.sur.valdesia.name},municipality:{"Baní":["Catalina ","El Carretón ","El Limonal ","Las Barías ","Matanzas ","Paya ","Sabana Buey ","Villa Fundación ","Villa Sombrero"],Nizao:["Pizarrete ","Santana"]}},"Puerto Plata":{region:{id:n.cibao.norte.id,name:n.cibao.name,zone:n.cibao.norte.name},municipality:{"Puerto Plata":["Maimón ","Yásica Arriba"],Altamira:["Río Grande"],Guananico:[],Imbert:[],"Los Hidalgos":["Navas"],"Luperón":["Belloso ","Estrecho ","La Isabela"],"Sosúa":["Cabarete","Sabaneta de Yásica"],"Villa Isabela":["Estero Hondo ","Gualete ","La Jaiba"],"Villa Montellano":[]}},"Samamá":{region:{id:n.cibao.nordeste.id,name:n.cibao.name,zone:n.cibao.nordeste.name},municipality:{"Samaná":["Arroyo Barril ","El Limón ","Las Galeras"],"Las Terrenas":[],"Sánchez":[]}},"San Cristóbal":{region:{id:n.sur.valdesia.id,name:n.sur.name,zone:n.sur.valdesia.name},municipality:{"San Cristóbal":["Hato Damas"],"Bajos de Haina":["El Carril"],"Cambita Garabito":["Cambita El Pueblecito"],"Los Cacaos":[],"Sabana Grande de Palenque":[],"San Gregorio de Nigua":[],"Villa Altagracia":["La Cuchilla ","Medina ","San José del Puerto"],Yaguate:[]}},"San José de Ocoa":{region:{id:n.sur.valdesia.id,name:n.sur.name,zone:n.sur.valdesia.name},municipality:{"San José de Ocoa":["El Naranjal ","El Pinar ","La Ciénaga ","Nizao-Las Auyamas"],"Rancho Arriba":[],"Sabana Larga":[]}},"San Juan":{region:{id:n.sur.elValle.id,name:n.sur.name,zone:n.sur.elValle.name},municipality:{"San Juan de la Maguana":["El Rosario ","Guanito ","Hato del Padre ","Hato Nuevo ","La Jagua ","Las Charcas de María Nova ","Pedro Corto ","Sabana Alta ","Sabaneta"],"Bohechío":["Arroyo Cano ","Yaque"],"El Cercado":["Batista ","Derrumbadero"],"Juan de Herrera":["Jínova"],"Las Matas de Farfán":["Carrera de Yegua","Matayaya"],Vallejuelo:["Jorjillo"]}},"San Pedro de Macorís":{region:{id:n.este.higuamo.id,name:n.este.name,zone:n.este.higuamo.name},municipality:{"San Pedro de Macorís":[],Consuelo:[],Guayacanes:[],Quisqueya:[],"Ramón Santana":[],"San José de Los Llanos":["El Puerto ","Gautier"]}},"Sánchez Ramírez":{region:{id:n.cibao.sur.id,name:n.cibao.name,zone:n.cibao.sur.name},municipality:{"Cotuí":["Caballero ","Comedero Arriba ","Quita Sueño"],Cevicos:["La Cueva ","Platanal"],Fantino:[],"La Mata":["Angelina ","La Bija ","Hernando Alonzo"]}},Santiago:{region:{id:n.cibao.norte.id,name:n.cibao.name,zone:n.cibao.norte.name},municipality:{Santiago:["Baitoa ","Hato del Yaque ","La Canela ","Pedro García ","San Francisco de Jacagua"],"Bisonó":[],"Jánico":["El Caimito ","Juncalito"],"Licey al Medio":["Las Palomas"],"Puñal":["Canabacoa ","Guayabal"],"Sabana Iglesia":[],"San José de las Matas":["El Rubio ","La Cuesta ","Las Placetas"],Tamboril:["Canca La Piedra"],"Villa González":["El Limón ","Palmar Arriba"]}},"Santiago Rodríguez":{region:{id:n.cibao.noroeste.id,name:n.cibao.name,zone:n.cibao.noroeste.name},municipality:{"San Ignacio de Sabaneta":[],"Los Almácigos":[],"Monción":[]}},"Santo Domingo":{region:{id:n.este.ozama.id,name:n.este.name,zone:n.este.ozama.name},municipality:{"Santo Domingo Este":["San Luis"],"Boca Chica":["La Caleta"],"Los Alcarrizos":["Palmarejo-Villa Linda ","Pantoja"],"Pedro Brand":["La Cuaba ","La Guáyiga"],"San Antonio de Guerra":["Hato Viejo"],"Santo Domingo Norte":["La Victoria"],"Santo Domingo Oeste":[]}},Valverde:{region:{id:n.cibao.noroeste.id,name:n.cibao.name,zone:n.cibao.noroeste.name},municipality:{Mao:["Ámina ","Guatapanal ","Jaibón (Pueblo Nuevo)"],Esperanza:["Boca de Mao ","Jicomé ","Maizal ","Paradero"],"Laguna Salada":["Cruce de Guayacanes ","Jaibón ","La Caya"]}}};a.exports={regions:n,provinces:o}},function(a,e){class n extends Error{constructor(a){super(a),this.name="UtilDoPackageError"}}a.exports=n},function(a,e,n){const{isRnc:o}=n(6),{_searchBy:i,_validateArgs:r,addConstant:t}=n(0);let l=!1;a.exports=new class{setStrictValidation(a){l=a}isAnIde(a){return r(a,"the value should be string or number",["string","number"],l),function(a){const e=a.replace(/\D/g,"");let n="";for(let a=0;a<10;a++){const o=Number(e[a]);n=n+=(0===a%2?1*o:2*o).toString()}const o=n.split("").reduce((a,e)=>+a+Number(e)),i=function(a){for(let e=a;e0}}([0,2,4,6,8,1,3,5,7,9]),e.exports=n.default},{}]},{},[1])(1)}))),n=["00000000018","11111111123","00100759932","00105606543","00114272360","00200123640","00200409772","00800106971","01200004166","01400074875","01400000282","03103749672","03200066940","03800032522","03900192284","04900026260","05900072869","07700009346","00114532330","03121982479","40200700675","40200639953","00121581750","00119161853","22321581834","00121581800","09421581768","22721581818","90001200901","00301200901","40200452735","40200401324","10621581792"];return{isCedula:function(a){return"string"==typeof a&&11===(a=a.replace(/[^\d]/g,"")).length&&(n.indexOf(a)>-1||e(a))},isRnc:function(a){return"string"==typeof a&&9===(a=a.replace(/[^\d]/g,"")).length&&function(a){a=a.split("").map((function(a){return parseInt(a,10)}));for(var e=[7,9,8,6,5,4,3,2],n=0,o=e.length-1;o>=0;o-=1)n+=e[o]*a[o];var i=n%11;return(0===i?2:1===i?1:11-i)===a.pop()}(a)}}}()}]); -------------------------------------------------------------------------------- /src/Geo/geo-data.js: -------------------------------------------------------------------------------- 1 | const regions = { 2 | cibao: { 3 | name: "Cibao", 4 | norte: { 5 | id: 1, 6 | name: "Cibao Norte", 7 | }, 8 | sur: { 9 | id: 2, 10 | name: "Cibao Sur", 11 | }, 12 | nordeste: { 13 | id: 3, 14 | name: "Cibao Nordeste", 15 | }, 16 | noroeste: { 17 | id: 4, 18 | name: "Cibao Noroeste", 19 | }, 20 | }, 21 | sur: { 22 | name: "Sur", 23 | valdesia: { 24 | id: 5, 25 | name: "Valdesia", 26 | }, 27 | elValle: { 28 | id: 6, 29 | name: "El Valle", 30 | }, 31 | enriquillo: { 32 | id: 7, 33 | name: "Enriquillo", 34 | }, 35 | }, 36 | este: { 37 | name: "Este", 38 | yuma: { 39 | id: 8, 40 | name: "Yuma", 41 | }, 42 | higuamo: { 43 | id: 9, 44 | name: "Higuamo", 45 | }, 46 | ozama: { 47 | id: 10, 48 | name: "Ozama", 49 | }, 50 | }, 51 | }; 52 | 53 | const provinces = { 54 | Azua: { 55 | region: { 56 | id: regions.sur.valdesia.id, 57 | name: regions.sur.name, 58 | zone: regions.sur.valdesia.name, 59 | }, 60 | municipality: { 61 | "Azua de Compostela": [ 62 | "Barreras", 63 | "Barro Arriba", 64 | "Clavellina", 65 | "Emma Balaguer Viuda Vallejo", 66 | "Las Barías-La Estancia", 67 | "Las Lomas", 68 | "Los Jovillos", 69 | "Puerto Viejo", 70 | ], 71 | Estebanía: [], 72 | Guayabal: [], 73 | "Las Charcas": ["Hatillo", "Palmar de Ocoa"], 74 | "Las Yayas de Viajama": ["Villarpando", "Hato Nuevo-Cortés"], 75 | "Padre Las Casas": ["La Siembra", "Las Lagunas", "Los Fríos"], 76 | Peralta: [], 77 | "Pueblo Viejo": ["El Rosario"], 78 | "Sabana Yegua": ["Proyecto 4", "Ganadero", "Proyecto 2-C"], 79 | "Tábara Arriba": ["Amiama Gómez", "Los Toros", "Tábara Abajo"], 80 | }, 81 | }, 82 | Bahoruco: { 83 | region: { 84 | id: regions.sur.enriquillo.id, 85 | name: regions.sur.name, 86 | zone: regions.sur.enriquillo.name, 87 | }, 88 | municipality: { 89 | Neiba: ["El Palmar"], 90 | Galván: ["El Salado"], 91 | "Los Ríos": ["Las Clavellinas"], 92 | Tamayo: [ 93 | "Cabeza de Toro", 94 | "Mena", 95 | "Monserrat", 96 | "Santa Bárbara-El 6 ", 97 | "Santana ", 98 | "Uvilla", 99 | ], 100 | }, 101 | }, 102 | Barahona: { 103 | region: { 104 | id: regions.sur.enriquillo.id, 105 | name: regions.sur.name, 106 | zone: regions.sur.enriquillo.name, 107 | }, 108 | municipality: { 109 | Barahona: ["El Cachón", "La Guázara", "Villa Central"], 110 | Cabral: [], 111 | "El Peñón": [], 112 | Enriquillo: ["Arroyo Dulce"], 113 | Fundación: ["Pescadería"], 114 | Jaquimeyes: ["Palo Alto"], 115 | "La Ciénaga": ["Bahoruco"], 116 | "Las Salinas": [], 117 | Paraíso: ["Los Patos"], 118 | Polo: [], 119 | "Vicente Noble": ["Canoa", "Fondo Negro", "Quita Coraza"], 120 | }, 121 | }, 122 | Dajabón: { 123 | region: { 124 | id: regions.cibao.noroeste.id, 125 | name: regions.cibao.name, 126 | zone: regions.cibao.noroeste.name, 127 | }, 128 | municipality: { 129 | Dajabón: ["Cañongo"], 130 | "El Pino": ["Manuel Bueno"], 131 | "Loma de Cabrera": ["Capotillo", "Santiago de la Cruz"], 132 | Partido: [], 133 | Restauración: [], 134 | }, 135 | }, 136 | Duarte: { 137 | region: { 138 | id: regions.cibao.nordeste.id, 139 | name: regions.cibao.name, 140 | zone: regions.cibao.nordeste.name, 141 | }, 142 | municipality: { 143 | "San Francisco de Macorís": [ 144 | "Cenoví", 145 | "Jaya", 146 | "La Peña", 147 | "Presidente Don Antonio Guzmán Fernández", 148 | ], 149 | Arenoso: ["El Aguacate", "Los Coles"], 150 | Castillo: [], 151 | "Eugenio María de Hostos": ["Sabana Grande"], 152 | "Las Guáranas": [], 153 | Pimentel: [], 154 | "Villa Riva": [ 155 | "Agua Santa del Yuna", 156 | "Barraquito", 157 | "Cristo Rey de Guaraguao", 158 | "Las Táranas", 159 | ], 160 | }, 161 | }, 162 | "El Seibo": { 163 | region: { 164 | id: regions.este.yuma.id, 165 | name: regions.este.name, 166 | zone: regions.este.yuma.name, 167 | }, 168 | municipality: { 169 | "El Seibo": ["Pedro Sánchez", "San Francisco-Vicentillo", "Santa Lucía"], 170 | Miches: ["El Cedro", "La Gina"], 171 | }, 172 | }, 173 | "Elías Piña": { 174 | region: { 175 | id: regions.sur.elValle.id, 176 | name: regions.sur.name, 177 | zone: regions.sur.elValle.name, 178 | }, 179 | municipality: { 180 | Comendador: ["Guayabo", "Sabana Larga"], 181 | Bánica: ["Sabana Cruz", "Sabana Higuero"], 182 | "El Llano": ["Guanito"], 183 | "Hondo Valle": ["Rancho de la Guardia"], 184 | "Juan Santiago": [], 185 | "Pedro Santana": ["Río Limpio"], 186 | }, 187 | }, 188 | Espaillat: { 189 | region: { 190 | id: regions.cibao.norte.id, 191 | name: regions.cibao.name, 192 | zone: regions.cibao.norte.name, 193 | }, 194 | municipality: { 195 | Moca: [ 196 | "Canca La Reina", 197 | "El Higüerito", 198 | "José Contreras", 199 | "Juan López", 200 | "La Ortega", 201 | "Las Lagunas", 202 | "Monte de la Jagua", 203 | "San Víctor", 204 | ], 205 | "Cayetano Germosén": [], 206 | "Gaspar Hernández": ["Joba Arriba", "Veragua", "Villa Magante"], 207 | "Jamao al Norte": [], 208 | }, 209 | }, 210 | "Hato Mayor": { 211 | region: { 212 | id: regions.este.higuamo.id, 213 | name: regions.este.name, 214 | zone: regions.este.higuamo.name, 215 | }, 216 | municipality: { 217 | "Hato Mayor del Rey": ["Guayabo Dulce", "Mata Palacio", "Yerba Buena"], 218 | "El Valle": [], 219 | "Sabana de la Mar": ["Elupina Cordero de Las Cañitas"], 220 | }, 221 | }, 222 | "Hermanas Mirabal": { 223 | region: { 224 | id: regions.cibao.nordeste.id, 225 | name: regions.cibao.name, 226 | zone: regions.cibao.nordeste.name, 227 | }, 228 | municipality: { 229 | Salcedo: ["Jamao Afuera"], 230 | Tenares: ["Blanco"], 231 | "Villa Tapia": [], 232 | }, 233 | }, 234 | Independencia: { 235 | region: { 236 | id: regions.sur.enriquillo.id, 237 | name: regions.sur.name, 238 | zone: regions.sur.enriquillo.name, 239 | }, 240 | municipality: { 241 | Jimaní: ["Boca de Cachón", "El Limón"], 242 | Cristóbal: ["El Batey 8"], 243 | Duvergé: ["Vengan a Ver"], 244 | "La Descubierta": [], 245 | Mella: ["La Colonia"], 246 | "Postrer Río": ["Guayabal"], 247 | }, 248 | }, 249 | "La Altagracia": { 250 | region: { 251 | id: regions.este.yuma.id, 252 | name: regions.este.name, 253 | zone: regions.este.yuma.name, 254 | }, 255 | municipality: { 256 | Higüey: ["La Otra Banda", "Lagunas de Nisibón", "Verón-Punta Cana"], 257 | "San Rafael del Yuma": ["Bayahibe", "Boca de Yuma"], 258 | }, 259 | }, 260 | "La Romana": { 261 | region: { 262 | id: regions.este.yuma.id, 263 | name: regions.este.name, 264 | zone: regions.este.yuma.name, 265 | }, 266 | municipality: { 267 | "La Romana": ["Caleta"], 268 | Guaymate: [], 269 | "Villa Hermosa": ["Cumayasa"], 270 | }, 271 | }, 272 | "La Vega": { 273 | region: { 274 | id: regions.cibao.sur.id, 275 | name: regions.cibao.name, 276 | zone: regions.cibao.sur.name, 277 | }, 278 | municipality: { 279 | "La Concepción de La Vega": ["El Ranchito", "Río Verde Arriba"], 280 | Constanza: ["La Sabina", "Tireo"], 281 | Jarabacoa: ["Buena Vista", "Manabao"], 282 | "Jima Abajo": ["Rincón"], 283 | }, 284 | }, 285 | "María Trinidad Sánchez": { 286 | region: { 287 | id: regions.cibao.nordeste.id, 288 | name: regions.cibao.name, 289 | zone: regions.cibao.nordeste.name, 290 | }, 291 | municipality: { 292 | Nagua: ["Arroyo al Medio ", "Las Gordas ", "San José de Matanzas"], 293 | Cabrera: ["Arroyo Salado ", "La Entrada"], 294 | "El Factor": ["El Pozo"], 295 | "Río San Juan": [], 296 | }, 297 | }, 298 | "Monseñor Nouel": { 299 | region: { 300 | id: regions.cibao.sur.id, 301 | name: regions.cibao.name, 302 | zone: regions.cibao.sur.name, 303 | }, 304 | municipality: { 305 | Bonao: [ 306 | "Arroyo Toro-Masipedro ", 307 | "La Salvia-Los Quemados ", 308 | "Jayaco ", 309 | "Juma Bejucal ", 310 | "Sabana del Puerto", 311 | ], 312 | Maimón: [], 313 | "Piedra Blanca": ["Juan Adrián ", "Villa Sonador"], 314 | }, 315 | }, 316 | Montecristi: { 317 | region: { 318 | id: regions.cibao.noroeste.id, 319 | name: regions.cibao.name, 320 | zone: regions.cibao.noroeste.name, 321 | }, 322 | municipality: { 323 | Montecristi: [], 324 | Castañuela: ["Palo Verde"], 325 | Guayubín: ["Cana Chapetón ", "Hatillo Palma ", "Villa Elisa"], 326 | "Las Matas de Santa Cruz": [], 327 | "Pepillo Salcedo": [], 328 | "Villa Vásquez": [], 329 | }, 330 | }, 331 | "Monte Plata": { 332 | region: { 333 | id: regions.este.higuamo.id, 334 | name: regions.este.name, 335 | zone: regions.este.higuamo.name, 336 | }, 337 | municipality: { 338 | "Monte Plata": ["Boyá ", "Chirino ", "Don Juan"], 339 | Bayaguana: [], 340 | Peralvillo: [], 341 | "Sabana Grande de Boyá": ["Gonzalo ", "Majagual"], 342 | Yamasá: ["Los Botados"], 343 | }, 344 | }, 345 | Pedernales: { 346 | region: { 347 | id: regions.sur.enriquillo.id, 348 | name: regions.sur.name, 349 | zone: regions.sur.enriquillo.name, 350 | }, 351 | municipality: { 352 | Pedernales: ["José Francisco Peña Gómez ", "Juancho"], 353 | Oviedo: [], 354 | }, 355 | }, 356 | Peravia: { 357 | region: { 358 | id: regions.sur.valdesia.id, 359 | name: regions.sur.name, 360 | zone: regions.sur.valdesia.name, 361 | }, 362 | municipality: { 363 | Baní: [ 364 | "Catalina ", 365 | "El Carretón ", 366 | "El Limonal ", 367 | "Las Barías ", 368 | "Matanzas ", 369 | "Paya ", 370 | "Sabana Buey ", 371 | "Villa Fundación ", 372 | "Villa Sombrero", 373 | ], 374 | Nizao: ["Pizarrete ", "Santana"], 375 | }, 376 | }, 377 | "Puerto Plata": { 378 | region: { 379 | id: regions.cibao.norte.id, 380 | name: regions.cibao.name, 381 | zone: regions.cibao.norte.name, 382 | }, 383 | municipality: { 384 | "Puerto Plata": ["Maimón ", "Yásica Arriba"], 385 | Altamira: ["Río Grande"], 386 | Guananico: [], 387 | Imbert: [], 388 | "Los Hidalgos": ["Navas"], 389 | Luperón: ["Belloso ", "Estrecho ", "La Isabela"], 390 | Sosúa: ["Cabarete", "Sabaneta de Yásica"], 391 | "Villa Isabela": ["Estero Hondo ", "Gualete ", "La Jaiba"], 392 | "Villa Montellano": [], 393 | }, 394 | }, 395 | Samaná: { 396 | region: { 397 | id: regions.cibao.nordeste.id, 398 | name: regions.cibao.name, 399 | zone: regions.cibao.nordeste.name, 400 | }, 401 | municipality: { 402 | Samaná: ["Arroyo Barril ", "El Limón ", "Las Galeras"], 403 | "Las Terrenas": [], 404 | Sánchez: [], 405 | }, 406 | }, 407 | "San Cristóbal": { 408 | region: { 409 | id: regions.sur.valdesia.id, 410 | name: regions.sur.name, 411 | zone: regions.sur.valdesia.name, 412 | }, 413 | municipality: { 414 | "San Cristóbal": ["Hato Damas"], 415 | "Bajos de Haina": ["El Carril"], 416 | "Cambita Garabito": ["Cambita El Pueblecito"], 417 | "Los Cacaos": [], 418 | "Sabana Grande de Palenque": [], 419 | "San Gregorio de Nigua": [], 420 | "Villa Altagracia": ["La Cuchilla ", "Medina ", "San José del Puerto"], 421 | Yaguate: [], 422 | }, 423 | }, 424 | "San José de Ocoa": { 425 | region: { 426 | id: regions.sur.valdesia.id, 427 | name: regions.sur.name, 428 | zone: regions.sur.valdesia.name, 429 | }, 430 | municipality: { 431 | "San José de Ocoa": [ 432 | "El Naranjal ", 433 | "El Pinar ", 434 | "La Ciénaga ", 435 | "Nizao-Las Auyamas", 436 | ], 437 | "Rancho Arriba": [], 438 | "Sabana Larga": [], 439 | }, 440 | }, 441 | "San Juan": { 442 | region: { 443 | id: regions.sur.elValle.id, 444 | name: regions.sur.name, 445 | zone: regions.sur.elValle.name, 446 | }, 447 | municipality: { 448 | "San Juan de la Maguana": [ 449 | "El Rosario ", 450 | "Guanito ", 451 | "Hato del Padre ", 452 | "Hato Nuevo ", 453 | "La Jagua ", 454 | "Las Charcas de María Nova ", 455 | "Pedro Corto ", 456 | "Sabana Alta ", 457 | "Sabaneta", 458 | ], 459 | Bohechío: ["Arroyo Cano ", "Yaque"], 460 | "El Cercado": ["Batista ", "Derrumbadero"], 461 | "Juan de Herrera": ["Jínova"], 462 | "Las Matas de Farfán": ["Carrera de Yegua", "Matayaya"], 463 | Vallejuelo: ["Jorjillo"], 464 | }, 465 | }, 466 | "San Pedro de Macorís": { 467 | region: { 468 | id: regions.este.higuamo.id, 469 | name: regions.este.name, 470 | zone: regions.este.higuamo.name, 471 | }, 472 | municipality: { 473 | "San Pedro de Macorís": [], 474 | Consuelo: [], 475 | Guayacanes: [], 476 | Quisqueya: [], 477 | "Ramón Santana": [], 478 | "San José de Los Llanos": ["El Puerto ", "Gautier"], 479 | }, 480 | }, 481 | "Sánchez Ramírez": { 482 | region: { 483 | id: regions.cibao.sur.id, 484 | name: regions.cibao.name, 485 | zone: regions.cibao.sur.name, 486 | }, 487 | municipality: { 488 | Cotuí: ["Caballero ", "Comedero Arriba ", "Quita Sueño"], 489 | Cevicos: ["La Cueva ", "Platanal"], 490 | Fantino: [], 491 | "La Mata": ["Angelina ", "La Bija ", "Hernando Alonzo"], 492 | }, 493 | }, 494 | Santiago: { 495 | region: { 496 | id: regions.cibao.norte.id, 497 | name: regions.cibao.name, 498 | zone: regions.cibao.norte.name, 499 | }, 500 | municipality: { 501 | Santiago: [ 502 | "Baitoa ", 503 | "Hato del Yaque ", 504 | "La Canela ", 505 | "Pedro García ", 506 | "San Francisco de Jacagua", 507 | ], 508 | Bisonó: [], 509 | Jánico: ["El Caimito ", "Juncalito"], 510 | "Licey al Medio": ["Las Palomas"], 511 | Puñal: ["Canabacoa ", "Guayabal"], 512 | "Sabana Iglesia": [], 513 | "San José de las Matas": ["El Rubio ", "La Cuesta ", "Las Placetas"], 514 | Tamboril: ["Canca La Piedra"], 515 | "Villa González": ["El Limón ", "Palmar Arriba"], 516 | }, 517 | }, 518 | "Santiago Rodríguez": { 519 | region: { 520 | id: regions.cibao.noroeste.id, 521 | name: regions.cibao.name, 522 | zone: regions.cibao.noroeste.name, 523 | }, 524 | municipality: { 525 | "San Ignacio de Sabaneta": [], 526 | "Los Almácigos": [], 527 | Monción: [], 528 | }, 529 | }, 530 | "Santo Domingo": { 531 | region: { 532 | id: regions.este.ozama.id, 533 | name: regions.este.name, 534 | zone: regions.este.ozama.name, 535 | }, 536 | municipality: { 537 | "Santo Domingo Este": ["San Luis"], 538 | "Boca Chica": ["La Caleta"], 539 | "Los Alcarrizos": ["Palmarejo-Villa Linda ", "Pantoja"], 540 | "Pedro Brand": ["La Cuaba ", "La Guáyiga"], 541 | "San Antonio de Guerra": ["Hato Viejo"], 542 | "Santo Domingo Norte": ["La Victoria"], 543 | "Santo Domingo Oeste": [], 544 | }, 545 | }, 546 | Valverde: { 547 | region: { 548 | id: regions.cibao.noroeste.id, 549 | name: regions.cibao.name, 550 | zone: regions.cibao.noroeste.name, 551 | }, 552 | municipality: { 553 | Mao: ["Ámina ", "Guatapanal ", "Jaibón (Pueblo Nuevo)"], 554 | Esperanza: ["Boca de Mao ", "Jicomé ", "Maizal ", "Paradero"], 555 | "Laguna Salada": ["Cruce de Guayacanes ", "Jaibón ", "La Caya"], 556 | }, 557 | }, 558 | }; 559 | 560 | module.exports = { regions, provinces }; 561 | --------------------------------------------------------------------------------