![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@snippetify/haiti-localities
Advanced tools
This module exposes a public API for Haiti's localities. You can search, filter or list localities by county, district, municipality and submunicipality.
Cette librairie expose une API publique pour les localités d'Haïti. Vous pouvez rechercher, filtrer ou lister toutes les localités par département, arrondissement, commune et section communale.
Snippetify is a community snippets warehouse but also a suite of tools that allow you to exploit these snippets.
Via npm:
npm install @snippetify/haiti-localities
Via yarn:
yarn add @snippetify/haiti-localities
In a browser via a script tag:
<script src="haiti-localities.js"></script>
CommonJS module require:
const haitiLocalities = require("@snippetify/haiti-localities")
ES2015 module import:
import haitiLocalities from "@snippetify/haiti-localities"
AMD module require:
require(['haitiLocalities'], function (haitiLocalities) {
// ...
});
haitiLocalities.getCounties()
Return an array of counties(départements)
const items = haitiLocalities.getCounties()
console.log(JSON.stringify(items))
// [
// {
// "map_id": 1,
// "area": 4987,
// "density": 350,
// "region": "Centre",
// "name": "Artibonite",
// "capital": "Gonaïves",
// "population": 1727524
// },
// {
// "map_id": 2,
// "area": 3487,
// "density": 210,
// "region": "Centre",
// "name": "Centre",
// "capital": "Hinche",
// "population": 746236
// },
// ...
// ]
haitiLocalities.getDistricts()
Return an array of districts(arrondissements)
const items = haitiLocalities.getDistricts()
console.log(JSON.stringify(items))
// [
// { county: 'Artibonite', name: 'Dessalines', aliases: [] },
// { county: 'Artibonite', name: 'Gonaïves', aliases: [] },
// { county: 'Artibonite', name: 'Gros Morne', aliases: [] },
// ...
// ]
haitiLocalities.getDistrictsByCounty(string)
Return an array of districts(arrondissements) for a county.
haitiLocalities.getMunicipalities()
Return an array of municipalities(communes)
const items = haitiLocalities.getMunicipalities()
console.log(JSON.stringify(items))
// [
// {
// county: 'Ouest',
// district: 'Arcahaie',
// name: 'Arcahaie',
// aliases: []
// },
// {
// county: 'Ouest',
// district: 'Arcahaie',
// name: 'Cabaret',
// aliases: []
// },
// ...
// ]
haitiLocalities.getMunicipalitiesByDistrict(string)
Return an array of municipalities(communes) for a district.
haitiLocalities.getMunicipalitiesByCounty(string)
Return an array of municipalities(communes) for a county.
haitiLocalities.getSubMunicipalities()
Return an array of submunicipalities(sections communales)
const items = haitiLocalities.getSubMunicipalities()
console.log(JSON.stringify(items))
// [
// {
// county: 'Centre',
// district: 'Mirebalais',
// municipality: "Saut d'Eau",
// name: 'Montagne Terrible',
// aliases: [],
// postal_code: 'HT0000'
// },
// {
// county: "Grand'Anse",
// district: "Anse d'Hainault",
// municipality: "Anse d'Hainault",
// name: 'Grandoit',
// aliases: [],
// postal_code: 'HT0000'
// },
// ...
// ]
haitiLocalities.getSubMunicipalitiesByMunicipality(string)
Return an array of submunicipalities(sections communales) for a municipality.
haitiLocalities.getSubMunicipalitiesByDistrict(string)
Return an array of submunicipalities(sections communales) for a district.
haitiLocalities.getSubMunicipalitiesByCounty(string)
Return an array of submunicipalities(sections communales) for a county.
haitiLocalities.find(string)
Return any county, district, municipality or submunicipality that matches the string.
Please see CHANGELOG for more information what has changed recently.
npm test
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.
FAQs
List of localities in Haiti
We found that @snippetify/haiti-localities demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.