Skip to content

A JavaScript library for querying administrative regions in Cambodia including Provinces, Districts, Communes and Villages.

License

Notifications You must be signed in to change notification settings

seanghay/pumi-js

Repository files navigation

pumi

ci npm npm npm

A JavaScript library for querying administrative regions in Cambodia including Provinces, Districts, Communes and Villages.

Supports Node.js, Browser and Deno.

Forked from kruyvanna/node-pumi

Installation

npm i pumi

Usage in Node.js

ESM

import { provinces, districts, communes, villages, all } from "pumi";

CommonJS

const { provinces, districts, communes, villages, all } = require("pumi");

Import Individual Data

ESM

import provinces from "pumi/provinces";
import districts from "pumi/districts";
import communes from "pumi/communes";
import villages from "pumi/villages";

CommonJS

const provinces = require("pumi/provinces");
const districts = require("pumi/districts");
const communes = require("pumi/communes");
const villages = require("pumi/villages");

Browser / Deno

import {
  provinces,
  districts,
  communes,
  villages,
  all,
} from "https://unpkg.com/pumi@latest/dist/main.mjs";

// Or
const { 
  provinces, 
  districts, 
  communes, 
  villages, 
  all 
} = await import(
  "https://unpkg.com/pumi@latest/dist/main.mjs"
);

Types

export interface LocalizedName {
  km: string;
  latin: string;
}

export interface AdministrativeUnit extends LocalizedName {
  en: string;
}

export interface AdministrativeDivision {
  id: string;
  name: LocalizedName;
  unit: AdministrativeUnit;
  parent?: string;
}

About

A JavaScript library for querying administrative regions in Cambodia including Provinces, Districts, Communes and Villages.

Topics

Resources

License

Stars

Watchers

Forks