soff-geo
v0.2.7~2KB CoreLightweight geographic data library for LATAM - Departments, municipalities, postal codes and more.
Live Demo - Municipality Search
Installation
npm install soff-geoQuick Start
// Import only what you need
import { getDepartments, getMunicipalities, searchMunicipalities } from 'soff-geo/co';
// Get all departments
const departments = getDepartments();
// [{ code: '05', name: 'Antioquia', ... }, ...]
// Get municipalities for a department
const antioquiaMunis = getDepartmentMunicipalities('05');
// [{ code: '05001', name: 'Medellín', ... }, ...]
// Search
const results = searchMunicipalities('medellin');
// [{ item: { name: 'Medellín', ... }, score: 1 }]Available Locales
🇨🇴Colombia
soff-geo/coDepartmentsMunicipalitiessearchvalidate codes
🇲🇽México
soff-geo/mxStatesMunicipalitiessearchvalidate codes
API Reference
Colombia
import {
getDepartments,
getMunicipalities,
getDepartment,
getMunicipality,
getDepartmentMunicipalities,
searchDepartments,
searchMunicipalities,
validateDepartmentCode,
validateMunicipalityCode
} from 'soff-geo/co';
// Get all departments
const depts = getDepartments();
// Get specific department
const antioquia = getDepartment('05');
// Get municipalities of a department
const munis = getDepartmentMunicipalities('05');
// Search
const results = searchMunicipalities('medellin', { limit: 5 });