{"_id":"@eh1z/nigerian-locations","_rev":"2-4c04c59be90d12cd8b8dbe62b6ae939a","name":"@eh1z/nigerian-locations","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@eh1z/nigerian-locations","version":"1.0.1","keywords":["nigeria","naija","location","locations","state","states","lga","local-government","cities","administrative","geography","geo","javascript","typescript"],"author":{"name":"Godsent Ehiz"},"license":"MIT","_id":"@eh1z/nigerian-locations@1.0.1","maintainers":[{"name":"eh1z","email":"godsentehiz11@gmail.com"}],"homepage":"https://github.com/Eh1z/nigerian-locations","bugs":{"url":"https://github.com/Eh1z/nigerian-locations/issues"},"dist":{"shasum":"9f729c571aa01f1c9ab82abff8cd38d3c97d4ac2","tarball":"https://registry.npmjs.org/@eh1z/nigerian-locations/-/nigerian-locations-1.0.1.tgz","fileCount":8,"integrity":"sha512-l0VxVb6KNhg1Kbs8zg6opQAqe4iA64hLvGawJMKFQtvvzh3cJHCXRuCmCiCtaVAMpxbDiRE29mmGE9I0h6p9ug==","signatures":[{"sig":"MEUCIBBUz9ujeqeTHQZz7ZaaLZTDYNclVGkVA2zNhPdiCDULAiEAuzSpgPbt8GtgEl8MS/RKPP1R2U4hT5tGVo6vF8DLUew=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5393123},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"8f9d2599f65a8b0ee0ff306b55a5eefc2ca2c2ff","scripts":{"build":"tsup","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"eh1z","email":"godsentehiz11@gmail.com"},"repository":{"url":"git+https://github.com/Eh1z/nigerian-locations.git","type":"git"},"_npmVersion":"11.16.0","description":"A lightweight JavaScript and TypeScript library providing Nigerian states, Local Government Areas (LGAs), cities, and other administrative location data.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^6.0.3","@types/node":"^24.13.2"},"_npmOperationalInternal":{"tmp":"tmp/nigerian-locations_1.0.1_1783261668570_0.17919665642739724","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@eh1z/nigerian-locations","version":"1.0.3","description":"A lightweight JavaScript and TypeScript library providing Nigerian states, Local Government Areas (LGAs), cities, and other administrative location data.","license":"MIT","author":{"name":"Godsent Ehiz"},"homepage":"https://github.com/Eh1z/nigerian-locations","engines":{"node":">=18"},"repository":{"type":"git","url":"git+https://github.com/Eh1z/nigerian-locations.git"},"bugs":{"url":"https://github.com/Eh1z/nigerian-locations/issues"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"tsup","typecheck":"tsc --noEmit","prepare":"npm run build"},"keywords":["nigeria","naija","location","locations","state","states","lga","local-government","cities","administrative","geography","geo","javascript","typescript"],"devDependencies":{"@types/node":"^24.13.2","tsup":"^8.5.1","typescript":"^6.0.3"},"gitHead":"5e76037bb47e7695b2944ecf4fb83f61d093451e","_id":"@eh1z/nigerian-locations@1.0.3","_nodeVersion":"22.22.3","_npmVersion":"11.16.0","dist":{"integrity":"sha512-KcrrKwe/nGwfTpBBK//aVcmqUp3KTNuerViciZY8iKYlQkEcEEyijFR/ffNwqmPRZkLJ+TKldiY06UwX9gDuKA==","shasum":"a6a3e93c95969fcb066e8373c82bcfd5ce7499d8","tarball":"https://registry.npmjs.org/@eh1z/nigerian-locations/-/nigerian-locations-1.0.3.tgz","fileCount":8,"unpackedSize":5393129,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBDPZrXoot1DoQnHRebJV3aeHXlB5+6jcF07gnDsL7QMAiAybjENe3LkLPEjBiCBNBZ/D4hCyq2RwftTNDrtFyKuCw=="}]},"_npmUser":{"name":"eh1z","email":"godsentehiz11@gmail.com"},"directories":{},"maintainers":[{"name":"eh1z","email":"godsentehiz11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nigerian-locations_1.0.3_1783261955066_0.22778297773771627"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-05T14:27:48.410Z","modified":"2026-07-05T14:32:35.336Z","1.0.1":"2026-07-05T14:27:48.774Z","1.0.3":"2026-07-05T14:32:35.221Z"},"bugs":{"url":"https://github.com/Eh1z/nigerian-locations/issues"},"author":{"name":"Godsent Ehiz"},"license":"MIT","homepage":"https://github.com/Eh1z/nigerian-locations","keywords":["nigeria","naija","location","locations","state","states","lga","local-government","cities","administrative","geography","geo","javascript","typescript"],"repository":{"type":"git","url":"git+https://github.com/Eh1z/nigerian-locations.git"},"description":"A lightweight JavaScript and TypeScript library providing Nigerian states, Local Government Areas (LGAs), cities, and other administrative location data.","maintainers":[{"name":"eh1z","email":"godsentehiz11@gmail.com"}],"readme":"# Nigerian Locations\n\nA lightweight JavaScript and TypeScript library that provides comprehensive Nigerian location data, including states, Local Government Areas (LGAs), and cities.\n\nPerfect for forms, address selectors, validation, dashboards, and any application that requires Nigerian administrative location data.\n\n## Features\n\n* 🇳🇬 Complete list of all 36 states and the FCT\n* 📍 Retrieve LGAs for any Nigerian state\n* 🏙️ Retrieve cities and areas within each LGA\n* 🔎 Retrieve all cities for a selected state\n* 🔁 Reverse lookup a city or area to its parent LGA\n* ⚡ Zero dependencies\n* 📦 Supports both ESM and CommonJS\n* 🔷 Fully typed with TypeScript\n* 🔍 Case insensitive lookups\n\n---\n\n## Installation\n\nUsing npm:\n\n```bash\nnpm install @eh1z/nigerian-locations\n```\n\nUsing Yarn:\n\n```bash\nyarn add @eh1z/nigerian-locations\n```\n\nUsing pnpm:\n\n```bash\npnpm add @eh1z/nigerian-locations\n```\n\nUsing Bun:\n\n```bash\nbun add @eh1z/nigerian-locations\n```\n\n---\n\n## Usage\n\n### ES Modules / TypeScript\n\n```ts\nimport {\n  getAllStates,\n  getLocalGovernments,\n  getLocalGovernmentByCity,\n  getCitiesByState,\n  getCities,\n} from \"@eh1z/nigerian-locations\";\n\nconst states = getAllStates();\nconst lgas = getLocalGovernments(\"Abia\");\nconst cityOptions = getCitiesByState(\"Abia\");\nconst lga = getLocalGovernmentByCity(\"Abia\", \"Ariaria\");\nconst cities = getCities(\"Abia\", \"Aba North\");\n\nconsole.log(states);\nconsole.log(lgas);\nconsole.log(cityOptions);\nconsole.log(lga);\nconsole.log(cities);\n```\n\n### CommonJS\n\n```js\nconst {\n  getAllStates,\n  getLocalGovernments,\n  getLocalGovernmentByCity,\n  getCitiesByState,\n  getCities,\n} = require(\"@eh1z/nigerian-locations\");\n\nconsole.log(getAllStates());\nconsole.log(getLocalGovernments(\"Abia\"));\nconsole.log(getCitiesByState(\"Abia\"));\nconsole.log(getLocalGovernmentByCity(\"Abia\", \"Ariaria\"));\nconsole.log(getCities(\"Abia\", \"Aba North\"));\n```\n\n---\n\n# API\n\n## `getAllStates(): string[]`\n\nReturns an alphabetically sorted array containing all Nigerian states, including the Federal Capital Territory (FCT).\n\n### Example\n\n```ts\ngetAllStates();\n```\n\nReturns:\n\n```ts\n[\n  \"Abia\",\n  \"Adamawa\",\n  \"Akwa Ibom\",\n  ...\n  \"Zamfara\"\n]\n```\n\n---\n\n## `getLocalGovernments(stateName: string): string[]`\n\nReturns all Local Government Areas (LGAs) for the specified state.\n\nThe lookup is case insensitive.\n\n### Example\n\n```ts\ngetLocalGovernments(\"Lagos\");\n```\n\nReturns:\n\n```ts\n[\n  \"Agege\",\n  \"Ajeromi-Ifelodun\",\n  \"Alimosho\",\n  ...\n]\n```\n\nIf the state does not exist, an empty array is returned.\n\n---\n\n## `getLocalGovernmentByCity(stateName: string, cityName: string): string`\n\nReturns the parent Local Government Area for a city, town, or area name within a selected state.\n\nThe lookup is case insensitive and scoped to the provided state.\n\n### Example\n\n```ts\ngetLocalGovernmentByCity(\"Abia\", \"Ariaria\");\n```\n\nReturns:\n\n```ts\n\"Aba North\"\n```\n\nIf no matching city is found, an empty string is returned.\n\n---\n\n## `getCitiesByState(stateName: string): string[]`\n\nReturns a sorted array of all unique cities, towns, and areas found anywhere in the selected state.\n\nThis is the helper to use for state-scoped city dropdowns when the frontend handles filtering and selection.\n\n### Example\n\n```ts\ngetCitiesByState(\"Abia\");\n```\n\nReturns:\n\n```ts\n[\n  \"Aba Isu\",\n  \"Aba Ukwu\",\n  \"Abaukwu\",\n  ...\n]\n```\n\nIf the state does not exist, an empty array is returned.\n\n---\n\n## `getCities(stateName: string, localGovernment: string): string[]`\n\nReturns all cities, towns, or areas associated with a Local Government Area.\n\nBoth the state and LGA lookups are case insensitive.\n\n### Example\n\n```ts\ngetCities(\"Abia\", \"Aba North\");\n```\n\nReturns:\n\n```ts\n[\n  \"Ariaria\",\n  \"Eziama\",\n  \"Ogbor Hill\",\n  ...\n]\n```\n\nIf either the state or LGA cannot be found, an empty array is returned.\n\n---\n\n# Notes\n\n* All returned arrays are alphabetically sorted.\n* Duplicate entries are removed before being returned.\n* `getCitiesByState` is the frontend-friendly source for city dropdowns scoped to a selected state.\n* Reverse lookup is state-scoped so city names resolve to the correct LGA without requiring the user to guess it.\n* The package ships with its data bundled, so no external downloads or runtime API calls are required.\n* Compatible with JavaScript and TypeScript projects.\n* Supports both ESM and CommonJS.\n\n---\n\n# Use Cases\n\nNigerian Locations is suitable for:\n\n* Address forms\n* Registration forms\n* Checkout flows\n* Location dropdowns\n* Data validation\n* Government portals\n* Logistics applications\n* Delivery services\n* Analytics dashboards\n* Nigerian business applications\n\n---\n\n# Contributing\n\nContributions are welcome.\n\nIf you'd like to improve the dataset, fix inaccuracies, or add new functionality, feel free to open an issue or submit a pull request.\n\n---\n\n# License\n\nThis project is licensed under the MIT License.","readmeFilename":"README.md"}