@clregions/core
Version:
¡Bienvenido! Con nuestra librería de TypeScript, podrás acceder fácilmente a información actualizada y precisa sobre las regiones, provincias y comunas de Chile, ahorrando tiempo y esfuerzo al no tener que recopilar y mantener los datos tú mismo.
58 lines (55 loc) • 3.22 kB
text/typescript
import { CLRegionObject, RegionId, CLProvinceObject, CLCommuneObject, ProvinceId, CommuneId } from '@clregions/data';
export { CLCommuneObject, CLProvinceObject, CLRegionObject, CommuneId, ProvinceId, RegionId } from '@clregions/data';
/**
* Returns a deep-cloned object containing all regions.
* @returns {Record<string, CLRegionObject>} The regions object.
*/
declare const findAllRegions: () => Record<string, CLRegionObject>;
/**
* Returns a deep-cloned region object by its identifier.
* @param {RegionId} regionId - The region identifier.
* @returns {CLRegionObject | null} The region object or null if not found.
*/
declare const findRegionById: (regionId: RegionId) => CLRegionObject | null;
/**
* Returns a deep-cloned object containing all provinces for a given region.
* @param {RegionId} regionId - The region identifier.
* @returns {Record<string, CLProvinceObject> | null} The provinces object or null if region not found.
*/
declare const findAllProvincesByRegion: (regionId: RegionId) => Record<string, CLProvinceObject> | null;
/**
* Returns all communes within a given region by iterating all provinces.
* @param {RegionId} regionId - The region identifier.
* @returns {Record<string, CLCommuneObject> | null} An object mapping commune identifiers to commune objects, or null if region not found.
*/
declare const findAllCommunesByRegion: (regionId: RegionId) => Record<string, CLCommuneObject> | null;
/**
* Returns a deep-cloned object containing all provinces from all regions.
* @returns {Record<string, CLProvinceObject>} An object mapping province identifiers to province objects.
*/
declare const findAllProvinces: () => Record<string, CLProvinceObject>;
/**
* Returns a deep-cloned province object by its identifier.
* @param {ProvinceId} provinceId - The province identifier.
* @returns {CLProvinceObject | null} The province object or null if not found.
*/
declare const findProvinceById: (provinceId: ProvinceId) => CLProvinceObject | null;
/**
* Returns a deep-cloned object containing all communes for a given province.
* @param {ProvinceId} provinceId - The province identifier.
* @returns {Record<string, CLCommuneObject> | null} An object mapping commune identifiers to commune objects, or null on failure.
*/
declare const findAllCommunesByProvince: (provinceId: ProvinceId) => Record<string, CLCommuneObject> | null;
/**
* Returns a deep-cloned object containing all communes from all regions.
* @returns {Record<string, CLCommuneObject>} An object mapping commune identifiers to commune objects.
*/
declare const findAllCommunes: () => Record<string, CLCommuneObject>;
/**
* Returns a deep-cloned commune object by its identifier.
* @param {CommuneId} communeId - The commune identifier.
* @returns {CLCommuneObject | null} The commune object or null if not found.
*/
declare const findCommuneById: (communeId: CommuneId) => CLCommuneObject | null;
declare const findRegionByCommune: (communeId: CommuneId) => CLRegionObject | null;
export { findAllCommunes, findAllCommunesByProvince, findAllCommunesByRegion, findAllProvinces, findAllProvincesByRegion, findAllRegions, findCommuneById, findProvinceById, findRegionByCommune, findRegionById };