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

use-nigeria-location

v1.0.0

Published

Custom hooks that provides you the list of all States, LGAs, Airports, Universities in Nigeria.

Downloads

52

Readme

use-nigeria-location

Custom hooks that provides you the list of all States, LGAs, Airports, Universities, Land mass, Geo-Political zones in Nigeria.

Follow this project's author, Muiz Haruna, and give the project a star ⭐ to show your appreciation and recommend to your friends.

Install

Install with npm

npm install use-nigeria-location

Usage

Fetch all information from all states

import { useAllStatesInfo } from "use-nigeria-location";

console.log(useAllStatesInfo())
/* => 
[{
  name: "Abia",
  capital: "Umuahia",
  id: "2e14a7ed-349a-44f6-9e12-abfec3e5f6ed",
  lgas: [
  { name: "Aba South", id: "4c840cb1-8f58-40d3-9aff-5a3b77fdba71" },

  ... ],
  land_mass: "6,320 km²",
  universities: 
  [
    {
      name: "Abia State University",
      location: "Uturu",
      type: "State",
    },

  ... ],
  airports: [],
  geopolitical_zone: "South East",
}, 

... ]
*/

Fetch all information from single state

import { useStateInfo } from "use-nigeria-location";

// takes state ID parameter

console.log(useStateInfo("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed"))
/* => 
{
  name: "Abia",
  capital: "Umuahia",
  id: "2e14a7ed-349a-44f6-9e12-abfec3e5f6ed",
  lgas: 
  [
  { name: "Aba South", id: "4c840cb1-8f58-40d3-9aff-5a3b77fdba71" },
  ...
  ],
  land_mass: "6,320 km²",
  universities: 
  [
  { name: "Abia State University",
    location: "Uturu",
    type: "State",
  },
  ...
  ],
  airports: [],
  geopolitical_zone: "South East",
}
*/

Fetch all states

import { useAllStates } from "use-nigeria-location";

console.log(useAllStates())
/* => 
[ 
  { name: "Abia", id: "2e14a7ed-349a-44f6-9e12-abfec3e5f6ed" },
  { name: "Adamawa", id: "3ac495b8-4196-4126-bf9e-bb8d43a0355d" },
  { name: "Akwa Ibom", id: "b6ed5429-7677-4aad-bf2a-97ce4f211494" },

... ]
*/

Fetch single state

import { useSingleState } from "use-nigeria-location";

// takes state ID parameter

console.log(useSingleState("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed"))
// => { name: "Abia", id: "2e14a7ed-349a-44f6-9e12-abfec3e5f6ed" }

Fetch capital of single state

import { useStateCapital } from "use-nigeria-location";

// takes state ID parameter

console.log(useStateCapital("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed")) 
// => "Umuahia"

Fetch all lgas from single state

import { useStateLGAs } from "use-nigeria-location";

// takes state ID parameter
console.log(useStateLGAs("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed"))
/* => 
[
  { name: "Aba South", id: "4c840cb1-8f58-40d3-9aff-5a3b77fdba71" },
  { name: "Arochukwu", id: "f46f5f01-43e1-440c-84a5-72382d0e6b94" },
  { name: "Bende", id: "836932e0-0aa7-4f7c-a3ef-44b5d30775c4" },

  ...
]
*/

Fetch single lga in single state

import { useSingleLGA } from "use-nigeria-location";

// takes state ID parameter and LGA ID parameter
console.log(useSingleLGA("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed", "4c840cb1-8f58-40d3-9aff-5a3b77fdba71"))
// => { name: "Aba South", id: "4c840cb1-8f58-40d3-9aff-5a3b77fdba71" }

Fetch land mass of single state

import { useStateLandMass } from "use-nigeria-location";

// takes state ID parameter

console.log(useStateLandMass("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed")) 
// => "6,320 km²"

Fetch all universities in single state

import { useStateUnis } from "use-nigeria-location";

// takes state ID parameter

console.log(useStateUnis("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed")) 
/* => 
[
  { 
  name: "Abia State University",
  location: "Uturu",
  type: "State",
  },
  {
  name: "Michael Okpara University of Agriculture",
  location: "Umudike",
  type: "Federal",
  },
]
*/

Fetch all airports in single state

import { useStateAirports } from "use-nigeria-location";

// takes state ID parameter

console.log(useStateAirports("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed")) 
// => []

Fetch geo-political zone of single state

import { useStateGeoPoli } from "use-nigeria-location";

// takes state ID parameter

console.log(useStateGeoPoli("2e14a7ed-349a-44f6-9e12-abfec3e5f6ed")) 
// => "South East"

Author

Muiz Haruna or DEVDESIIGNN

Connect with me:

Twitter: @dev_desiignn Facebook: @devdesiignnn LinkedIn: @devdesiignn

License

Copyright © 2024 Muiz Haruna.

This project is licensed under the MIT License.

Thank you for using this package. 🔥 && 🧊