UNPKG

nigeria-bus-stops

Version:

List of Nigerian Main Areas in all States and LGAs

85 lines (55 loc) 1.88 kB
# nigeria-bus-stops A dataset of Nigerian bus stops and notable places organized by state and LGA, with TypeScript enums for safe access. ## Installation ```bash npm install nigeria-bus-stops ``` ## Usage ### 1. Import the package If using JavaScript (CommonJS): ```js const { nigeriaBusStops, States, CrossRiverLGA } = require("nigeria-bus-stops"); ``` If using TypeScript or ES Modules: ```ts import { nigeriaBusStops, States, CrossRiverLGA } from "nigeria-bus-stops"; ``` ### 2. Accessing Bus Stops #### By State and LGA Use the provided enums for safe and typo-free access: ```js const stops = nigeriaBusStops[States.CROSS_RIVER][CrossRiverLGA.CALABAR_MUNICIPAL]; console.log(stops); // Output: [ 'Calabar', 'Marine Base', 'Ekorinim', 'Henshaw Town', 'Big Qua' ] ``` #### Example: List all LGAs in a State ```js const { NigeriaLGAs } = require("nigeria-bus-stops"); console.log(Object.values(NigeriaLGAs[States.LAGOS])); ``` ### 3. TypeScript Support All enums and data are fully typed for TypeScript users. ```ts import { nigeriaBusStops, States, LagosLGA } from "nigeria-bus-stops"; const stops: string[] = nigeriaBusStops[States.LAGOS][LagosLGA.IKEJA]; ``` ### 4. Full Example ```js const { nigeriaBusStops, States, CrossRiverLGA } = require("nigeria-bus-stops"); console.log( nigeriaBusStops[States.CROSS_RIVER][CrossRiverLGA.CALABAR_MUNICIPAL] ); ``` ``` ## API - `nigeriaBusStops`: Main data object, accessed by `[State][LGA]`. - `States`: Enum of all 36 states + FCT. - `[State]LGA`: Enum of all LGAs for each state (e.g., `LagosLGA`, `CrossRiverLGA`). - `NigeriaLGAs`: Object mapping each state to its LGA enum. ## Notes - Always use the enums for keys to avoid typos. - The package is compatible with both JavaScript and TypeScript. ## License MIT ```