npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

locations-ng

v1.0.1

Published

Locations NG is a JavaScript library that provides functions to get all states, their cities and LGAs in Nigeria.

Downloads

77

Readme

Locations NG · GitHub license npm version <ORG_NAME> PRs Welcome

Locations NG is a JavaScript library that provides functions to get all states, their cities and LGAs in Nigeria.

Installation

Using npm:

$ npm install locations-ng

Note: add --save if you are using npm < 5.0.0

Using yarn:

$ yarn add locations-ng

Usage

Require the package

var locationsNg = require('locations-ng')

1. GET all States, canonical

locationsNg.state.all()

Response

[
  {name: 'Abia', capital: 'Umuahia'},
  {name: 'Adamawa', capital: 'Yola'},
  {name: 'Akwa Ibom', capital: 'Uyo'},
  ...
  ...
  {name: 'Zamfara',capital: 'Gusau'}
]

2. GET detailed data of a State

locationsNg.state.details('Lagos')

Response

{
  minLat: 6.3936419,
  name: 'Lagos',
  capital: 'Ikeja',
  latitude: 6.5243793,
  minLong: 3.0982732,
  maxLat: 6.7027984,
  longitude: 3.3792057,
  maxLong: 3.696727799999999,
  alias: 'lagos',
  area: 3345
  cities: ['Agege', 'Ikeja'],
  lgas: ['Agege', 'Ajeromi-Ifelodun', 'Alimosho',
          'Amuwo-Odofin', 'Badagry', 'Apapa', 'Epe',
          'Eti Osa', 'Ibeju-Lekki', 'Ifako-Ijaiye',
          'Ikeja', 'Ikorodu', 'Kosofe', 'Lagos Island',
          'Mushin', 'Lagos Mainland', 'Ojo', 'Oshodi-Isolo',
          'Shomolu', 'Surulere Lagos State']
}

3. GET State capital

locationsNg.state.capital('Lagos')

Response

Ikeja

4. GET all Cities

locationsNg.city.all()

Response

[
  {
    state: 'Akwa Ibom',
    alias: 'akwa_ibom',
    cities: ['Eket', 'Ikot Ekpene', 'Oron', 'Uyo']
  },
  {
    state: 'Bauchi',
    alias: 'bauchi',
    cities: ['Bauchi']
  },
  ...
  ...
  {
    state: 'Zamfara',
    alias: 'zamfara',
    cities: ['Gusau']
  }
]

5. GET Cities in a State

locationsNg.city.cities('Akwa Ibom')

Response

['Eket', 'Ikot Ekpene', 'Oron', 'Uyo']

6. GET all LGAs

locationsNg.lga.all()

Response

[
  {
    state: 'Adamawa',
    alias: 'adamawa',
    lgas: [
      'Demsa',
      'Fufure',
      'Ganye',
      'Gayuk',
      'Gombi',
      'Grie',
      'Hong',
      'Jada',
      'Larmurde',
      'Madagali',
      'Maiha',
      'Mayo Belwa',
      'Michika',
      'Mubi North',
      'Mubi South',
      'Numan',
      'Shelleng',
      'Song',
      'Toungo',
      'Yola North',
      'Yola South'
    ]
  },
  ...
  ...
  {
    state: 'Abia',
    alias: 'abia',
    lgas: [
      'Aba North',
      'Arochukwu',
      'Aba South',
      'Bende',
      'Isiala Ngwa North',
      'Ikwuano',
      'Isiala Ngwa South',
      'Isuikwuato',
      'Obi Ngwa',
      'Ohafia',
      'Osisioma',
      'Ugwunagbo',
      'Ukwa East',
      'Ukwa West',
      'Umuahia North',
      'Umuahia South',
      'Umu Nneochi'
    ]
  }
]

7. GET LGAs in a State

locationsNg.lga.lgas('Lagos')

Response

['Agege', 'Ajeromi-Ifelodun', 'Alimosho',
 'Amuwo-Odofin', 'Badagry', 'Apapa', 'Epe',
 'Eti Osa', 'Ibeju-Lekki', 'Ifako-Ijaiye',
 'Ikeja', 'Ikorodu', 'Kosofe', 'Lagos Island',
 'Mushin', 'Lagos Mainland', 'Ojo', 'Oshodi-Isolo',
 'Shomolu', 'Surulere Lagos State']

8. GET Localities for LGAs in a State (query with state and LGA)

locationsNg.lga.localities('Abia', 'Aba North')

Response

['Ariaria', 'Asaokpoja', 'Asaokpulor',
 'Eziama  ward', 'Industrial', 'Ogbor 1',
 'Ogbor 2', 'Old GRA', 'Osusu 1', 'Osusu 2',
 'St. Eugene', 'Umuogor', 'Umuola', 'Uratta']

Contributing

  • Fork this repository and clone locally.
  • Create an upstream remote and sync your local copy before you branch.
  • Branch for each separate piece of work.
  • Push to your origin repository.
  • Create a new Pull Request, ensure that the 'base fork' points to the correct repository and branch.

License

MIT