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

ngn-states-lgas

v1.0.1

Published

A package to retrieve Nigerian states and their LGAs.

Readme

Nigeria States and LGAs Package

A simple JavaScript/TypeScript package that provides a list of all states in Nigeria, along with their respective Local Government Areas (LGAs). This package works for both JavaScript and TypeScript projects.

Features

  • Get a list of all Nigerian states.
  • Retrieve the LGAs for a specific state.
  • Case-insensitive querying (supports abbreviations and full names for the Federal Capital Territory).
  • Supports both JavaScript and TypeScript projects.

Installation

You can install the package from npm.

npm

npm install ngn-states-lgas
yarn add ngn-states-lgas

Installation

You can install the package from yarn.

yarn

yarn add ngn-states-lgas
for JavaScript
const { getStates, getLgas } = require('ngn-states-lgas');

// Get all states in Nigeria
const states = getStates();
console.log(states); // ["Abia", "Adamawa", ..., "Zamfara"]

// Get LGAs for a specific state
const lagosLgas = getLgas('Lagos');
console.log(lagosLgas); // ["Agege", "Alimosho", "Ikeja", "Surulere"]

// Get LGAs for the Federal Capital Territory (case-insensitive input)
const fctLgas = getLgas('fct');
console.log(fctLgas); // ["Abaji", "Bwari", "Gwagwalada", "Kuje", "Kwali", "Municipal Area Council"]
for TypeScript
import { getStates, getLgas } from 'ngn-states-lgas';

// Get all states in Nigeria
const states: string[] = getStates();
console.log(states); // ["Abia", "Adamawa", ..., "Zamfara"]

// Get LGAs for a specific state
const lagosLgas: string[] = getLgas('Lagos');
console.log(lagosLgas); // ["Agege", "Alimosho", "Ikeja", "Surulere"]

// Get LGAs for the Federal Capital Territory (case-insensitive input)
const fctLgas: string[] = getLgas('fct');
console.log(fctLgas); // ["Abaji", "Bwari", "Gwagwalada", "Kuje", "Kwali", "Municipal Area Council"]

Functions

getStates()
- Returns a list of all states in Nigeria.
- Returns: An array of state names (strings).

getLgas(state: string)
- Returns a list of Local Government Areas (LGAs) for the specified state. The state name is case-insensitive.

- Parameters:
   - state: A string representing the state name. It can be the full name or an abbreviation for the Federal Capital Territory (e.g., 'fct', 'abuja', 'f c t').
- Returns: An array of LGAs (strings) for the specified state.
- Throws: If the state is not found, an error is thrown.

Example

const lagosLgas = getLgas('Lagos'); // returns ["Agege", "Alimosho", "Ikeja", "Surulere"]

Data

The package includes data for the 36 states of Nigeria and the Federal Capital Territory (FCT), with their respective LGAs.

The states and LGAs are stored in a JSON format, which is imported into the package. Aliases for Federal Capital Territory (FCT) The following aliases are recognized for the Federal Capital Territory:

  • 'fct'
  • 'f.c.t'
  • 'abuja'
  • 'f c t'
  • 'Federal Capital Territory'
  • 'federal capital territory'
  • 'federalcapitalterritory' These aliases will all return the LGAs for the Federal Capital Territory.

Example

Example of getStates usage:

const states = getStates();
console.log(states);  // Output: ['Abia', 'Adamawa', 'Akwa Ibom', ..., 'Zamfara']

Example of getLgas usage:

const lagosLgas = getLgas('Lagos');
console.log(lagosLgas);
// Output: ['Agege', 'Alimosho', 'Ikeja', 'Surulere']

const fctLgas = getLgas('fct');
console.log(fctLgas);
// Output: ['Abaji', 'Bwari', 'Gwagwalada', 'Kuje', 'Kwali', 'Municipal Area Council']

Testing

To run unit tests, make sure you have Jest installed and configured in your project. You can then run the tests using the following command:

npx jest

Optional: Test Coverage

If you'd like to generate a test coverage report, you can use:

npx jest --coverage

License

This project is licensed under the MIT License

Contributing

Feel free to fork the repository, make changes, and create pull requests. We welcome contributions that improve the functionality or documentation of this package.