JSPM

territory-indonesia

0.1.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 41
  • Score
    100M100P100Q89609F
  • License MIT

Territories of Indonesia

Package Exports

  • territory-indonesia
  • territory-indonesia/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (territory-indonesia) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Territory Indonesia

Territories of Indonesia

NPM Version NPM Downloads

Installation

$ npm install territory-indonesia
or
$ yarn add territory-indonesia

Usage

import indonesia from 'territory-indonesia'

// Get all provinces
indonesia
  .getAllProvinces()
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get province by id
indonesia
  .getProvinceById('31')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// result :
// {
//   "id": "31",
//   "name": "DKI JAKARTA",
//   "alt_name": "DKI JAKARTA",
//   "latitude": 6.1745,
//   "longitude": 106.8227
// },

// Get all regencies
indonesia
  .getAllRegencies(31)
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get regency by id
indonesia
  .getRegencyById('3171')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// result :
// {
//   "id": "3171",
//   "province_id": "31",
//   "name": "KOTA JAKARTA SELATAN",
//   "alt_name": "KOTA JAKARTA SELATAN",
//   "latitude": -6.266,
//   "longitude": 106.8135
// },

// Get regencies by name
indonesia
  .getRegencyByName('Kota Jakarta Selatan')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get regencies by province id
indonesia
  .getRegenciesOfProvinceId('31')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get regencies by province name
indonesia
  .getRegenciesOfProvinceName('DKI Jakarta')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// result :
// [
//  {
//   "id": "3171",
//   "province_id": "31",
//   "name": "KOTA JAKARTA SELATAN",
//   "alt_name": "KOTA JAKARTA SELATAN",
//   "latitude": -6.266,
//   "longitude": 106.8135
//  },
//  {
//    .....
//  }
// ],

// Get all districts
indonesia
  .getAllDistricts()
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get district by id
indonesia
  .getDistrictById('3171090')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// result :
// {
//   "id": "3171090",
//   "regency_id": "3171",
//   "name": "TEBET",
//   "alt_name": "Tebet, South Jakarta City, Special Capital Region of Jakarta, Indonesia",
//   "latitude": -6.23186,
//   "longitude": 106.84734
// },

// Get district by name
indonesia
  .getDistrictByName('Tebet')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get district by regencyId
indonesia
  .getDistrictsOfRegencyId('3171')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// result :
// {
//   "id": "3171090",
//   "regency_id": "3171",
//   "name": "TEBET",
//   "alt_name": "Tebet, South Jakarta City, Special Capital Region of Jakarta, Indonesia",
//   "latitude": -6.23186,
//   "longitude": 106.84734
// },

// Get all villages
indonesia
  .getAllVillages()
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get village by id
indonesia
  .getVillageById('3171090002')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get village by name
indonesia
  .getVillageByName('Tebet Barat')
  .then(res => console.log(res))
  .catch(err => console.log(err))

// Get village by districtId
indonesia
  .getVillagesOfDistrictId('3171090')
  .then(res => console.log(res))
  .catch(err => console.log(err))

Contributors

Thank you to all the people who already to Territories of Indonesia!

Eko
Eko
Leonardo
Leonardo

License

License - see the LICENSE file for details