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.
- Save your snippets to the cloud
- Search snippets
- Deep searching (search for snippets all over the web)
- Share your snippets
- Embed snippets in your forum or blog
- Organize your snippets with tags
- Contribute on snippets of others
- Enhance your snippets by receiving votes and comments
- Make coding fun by challenging your friends
- Work on your notoriety by publishing good snippets which will allow you to receive stars, badges and privileges
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) {
// ...
});
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
// },
// ...
// ]
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: [] },
// ...
// ]
Return an array of districts(arrondissements) for a county.
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: []
// },
// ...
// ]
Return an array of municipalities(communes) for a district.
Return an array of municipalities(communes) for a county.
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'
// },
// ...
// ]
Return an array of submunicipalities(sections communales) for a municipality.
Return an array of submunicipalities(sections communales) for a district.
Return an array of submunicipalities(sections communales) for a county.
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.