1.1.3 • Published 6 years ago

guinea-subdivision v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

guinea-subdivision

This package give you all guinea administrative subdivision. by regions, prefectures, sous-prefectures.

Installation

With yarn:

$ yarn add guinea-subdivision --save

With npm:

$ npm i guinea-subdivision --save
Functions:

here are all the functions, that you can import and use some of them return and array and some of them retourn a json object

FunctionExplainationReturn Type
getRegionsAndCodes()return all regions and their codesJson
getRegions()return the list of the regions (names only)Array
getRegionsCodes()return the regions codes onlyArray
getRegionNameByCode()you give it a region code and it return you the nameString
getRegionCodeByName()you give it a region name and it return you the codeString
--------------------------------------------------------------------------
getPrefecturesAndCodes()return all prefectures and their codesJson
getPrefecturesCodes()return the prefecutres codes onlyArray
getPrefectures()return the list of the prefecutresArray
getPrefecturesAndCodesByRegionCode()return all prefectures and thier code by it region codeJson
getPrefecturesByRegionCode()return all prefectures by it region codeArray
getPrefecturesByRegionName()return all prefectures by it region nameArray
getPrefectureNameByCode()you give it a prefecture code and it give you the nameString
getPrefectureCodeByName()you give it a prefecture anme and it give you the codeString
------------------------------------------------------------------------
getSousprefecturesAndCodes()return all sousprefectures and their codesJson
getSousprefecturesCodes()return all sousprefectures codesArray
getSousprefectures()return all sousprefectures codesArray
getSousprefecturesAndCodesByPrefectureCode()it return all sous prefectures and their codes based on a given prefecture codejson
getSousprefecturesAndCodesByPrefectureName()it return all sous prefectures and their codes based on a given prefecture nameJson
getSousprefecturesByPrefectureCode()it return all sous prefectures based on a given prefecture codeArray
getSousprefecturesByPrefectureName()it return all sous prefectures based on a given prefecture nameArray
getSousprefectureNameByCode()you give it a sousprefecture code and it give you the nameString
getSousprefectureCodeByName()you give it a sousprefecture name and it give you the codeString

Usage

If you have successfully installed this package and you're ready to use it, first import the functions you need based on the top table like this:

import { getRegions, getPrefecturesCodes, getSousprefecturesByPrefectureCode } from 'guinea-subdivision';

// then call them like
console.log(getRegions())
console.log(getPrefecturesCodes())
console.log(getSousprefecturesByPrefectureCode(getPrefecturesCodes()[3]))

Developpers Section

If you wan to help improving this package, or you want to fix a bug founded bug or anything else like documentation, etc.. You are welcome, we hope that you will make this package very usefull to some other people. then go ahead an make a PR.

The code

The code is writen in ES6 (es2015) and compiled with babel, packaged (minified) under webpack 4 (see package.json file)

  • First of all, you need to install dependancies (including devDepenancies)
  • go to src/index.js, this is where all the logic function are
  • go to src/data/ to update the subdivision data

Building

If you have done a changes and you want to build, just run the following command

Test build

To build a test version (not minified) run the following command

npm run dev

Prod build

To build a minified version for production use, run the following command

npm run prod

Runing the test suite

To run the test suite make sure first you've :

  • 1 - ran the dev build command
  • 2 - ran the prod build thos are needed to minify administrative json files that are used in the dist/index.js note: the test suite are made on dist/index.js

then run the following command npm run test

A bug on UMD (Universal Module Definition)

A Tuto can be found here

After a build including the UMD extension, i notice that there is a bug on compiled version located at './dist/index.js' the variable global on a dev build (Line 10) or a prod build (Line 3) that variable should be replace by this reserved word.

// this is a dev build
// replace this line
})(global, function() {

// by the following
})(this, function() {

Then go ahead and make your PR

Data source: www.stat-guinee.org guinee-decouverte.com

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.0

6 years ago