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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eh1z/nigerian-locations

v1.0.3

Published

A lightweight JavaScript and TypeScript library providing Nigerian states, Local Government Areas (LGAs), cities, and other administrative location data.

Readme

Nigerian Locations

A lightweight JavaScript and TypeScript library that provides comprehensive Nigerian location data, including states, Local Government Areas (LGAs), and cities.

Perfect for forms, address selectors, validation, dashboards, and any application that requires Nigerian administrative location data.

Features

  • 🇳🇬 Complete list of all 36 states and the FCT
  • 📍 Retrieve LGAs for any Nigerian state
  • 🏙️ Retrieve cities and areas within each LGA
  • 🔎 Retrieve all cities for a selected state
  • 🔁 Reverse lookup a city or area to its parent LGA
  • ⚡ Zero dependencies
  • 📦 Supports both ESM and CommonJS
  • 🔷 Fully typed with TypeScript
  • 🔍 Case insensitive lookups

Installation

Using npm:

npm install @eh1z/nigerian-locations

Using Yarn:

yarn add @eh1z/nigerian-locations

Using pnpm:

pnpm add @eh1z/nigerian-locations

Using Bun:

bun add @eh1z/nigerian-locations

Usage

ES Modules / TypeScript

import {
  getAllStates,
  getLocalGovernments,
  getLocalGovernmentByCity,
  getCitiesByState,
  getCities,
} from "@eh1z/nigerian-locations";

const states = getAllStates();
const lgas = getLocalGovernments("Abia");
const cityOptions = getCitiesByState("Abia");
const lga = getLocalGovernmentByCity("Abia", "Ariaria");
const cities = getCities("Abia", "Aba North");

console.log(states);
console.log(lgas);
console.log(cityOptions);
console.log(lga);
console.log(cities);

CommonJS

const {
  getAllStates,
  getLocalGovernments,
  getLocalGovernmentByCity,
  getCitiesByState,
  getCities,
} = require("@eh1z/nigerian-locations");

console.log(getAllStates());
console.log(getLocalGovernments("Abia"));
console.log(getCitiesByState("Abia"));
console.log(getLocalGovernmentByCity("Abia", "Ariaria"));
console.log(getCities("Abia", "Aba North"));

API

getAllStates(): string[]

Returns an alphabetically sorted array containing all Nigerian states, including the Federal Capital Territory (FCT).

Example

getAllStates();

Returns:

[
  "Abia",
  "Adamawa",
  "Akwa Ibom",
  ...
  "Zamfara"
]

getLocalGovernments(stateName: string): string[]

Returns all Local Government Areas (LGAs) for the specified state.

The lookup is case insensitive.

Example

getLocalGovernments("Lagos");

Returns:

[
  "Agege",
  "Ajeromi-Ifelodun",
  "Alimosho",
  ...
]

If the state does not exist, an empty array is returned.


getLocalGovernmentByCity(stateName: string, cityName: string): string

Returns the parent Local Government Area for a city, town, or area name within a selected state.

The lookup is case insensitive and scoped to the provided state.

Example

getLocalGovernmentByCity("Abia", "Ariaria");

Returns:

"Aba North"

If no matching city is found, an empty string is returned.


getCitiesByState(stateName: string): string[]

Returns a sorted array of all unique cities, towns, and areas found anywhere in the selected state.

This is the helper to use for state-scoped city dropdowns when the frontend handles filtering and selection.

Example

getCitiesByState("Abia");

Returns:

[
  "Aba Isu",
  "Aba Ukwu",
  "Abaukwu",
  ...
]

If the state does not exist, an empty array is returned.


getCities(stateName: string, localGovernment: string): string[]

Returns all cities, towns, or areas associated with a Local Government Area.

Both the state and LGA lookups are case insensitive.

Example

getCities("Abia", "Aba North");

Returns:

[
  "Ariaria",
  "Eziama",
  "Ogbor Hill",
  ...
]

If either the state or LGA cannot be found, an empty array is returned.


Notes

  • All returned arrays are alphabetically sorted.
  • Duplicate entries are removed before being returned.
  • getCitiesByState is the frontend-friendly source for city dropdowns scoped to a selected state.
  • Reverse lookup is state-scoped so city names resolve to the correct LGA without requiring the user to guess it.
  • The package ships with its data bundled, so no external downloads or runtime API calls are required.
  • Compatible with JavaScript and TypeScript projects.
  • Supports both ESM and CommonJS.

Use Cases

Nigerian Locations is suitable for:

  • Address forms
  • Registration forms
  • Checkout flows
  • Location dropdowns
  • Data validation
  • Government portals
  • Logistics applications
  • Delivery services
  • Analytics dashboards
  • Nigerian business applications

Contributing

Contributions are welcome.

If you'd like to improve the dataset, fix inaccuracies, or add new functionality, feel free to open an issue or submit a pull request.


License

This project is licensed under the MIT License.