ng-states-core
v2.1.0
Published
A modern TypeScript library for Nigerian states, local governments, and senatorial districts with zero dependencies
Maintainers
Readme
ng-states-core
A modern, type-safe TypeScript library for Nigerian states, LGAs, senatorial districts, capitals, and major towns with zero dependencies.
Features
- 🎯 TypeScript First - Full type safety with comprehensive type definitions
- 📦 Zero Dependencies - Lightweight and fast
- 🌍 Complete Data - All 36 states + FCT with LGAs, senatorial districts, capitals, and major towns
- 🗺️ Geopolitical Zones - Filter and group states by Nigeria's 6 geopolitical zones
- � Rich Metadata - Coordinates, postal codes, population, creation dates, and slogans
- � Powerful Search - Find states by LGA, town, or use fuzzy search
- ✅ Well Tested - 28+ tests ensuring reliability
Installation
npm install ng-states-coreQuick Start
import { getState, findStateByLga, getStatesByRegion } from "ng-states-core";
// Get complete state data
const lagos = getState("Lagos");
console.log(lagos.capital); // 'Ikeja'
console.log(lagos.population); // 15400000
console.log(lagos.region); // 'South-West'
// Find state by LGA
const state = findStateByLga("Ikeja");
console.log(state?.state); // 'Lagos'
// Get all South-West states
const southWest = getStatesByRegion("South-West");
// ['Ekiti', 'Lagos', 'Ogun', 'Ondo', 'Osun', 'Oyo']Available Functions
State Functions
getStates() · getStateNames() · getState() · getStatesAndCapitals() · getCapital() · getLgas() · getSenatorialDistricts() · getTowns()
Search Functions
findStateByLga() · findStateByTown() · searchStates() · searchTowns()
Geopolitical Zones
getGeopoliticalZones() · getStatesByRegion() · getRegion()
Metadata
getPostalCode() · getCoordinates() · getPopulation() · getCreationDate() · getSlogan()
Documentation
📚 Full Documentation - Comprehensive guides and API reference
� Examples - React, Vue, Next.js, and more
🤝 Contributing - Help improve this package
Data Coverage
| Category | Count | | ------------------------- | ----- | | States | 36 | | Federal Capital Territory | 1 | | Total LGAs | 774 | | Senatorial Districts | 109 | | State Capitals | 37 | | Major Towns | 1000+ | | Geopolitical Zones | 6 |
TypeScript Support
import type { State, StateData, GeopoliticalZone } from "ng-states-core";
const state: State = getState("Lagos");
const zone: GeopoliticalZone = "South-West";License
MIT © Solomon Olatunji
Made with ❤️ for Nigeria 🇳🇬
