UNPKG

kenya-locations

Version:

A comprehensive and intuitive TypeScript package for working with Kenyan administrative divisions (counties, sub-counties, constituencies, and wards)

80 lines (79 loc) 2.38 kB
import { Area, Locality, County } from './types'; /** * Get all areas * @returns Array of all areas * @example * ```ts * import { getAreas } from 'kenya-locations/areas'; * const areas = getAreas(); * ``` */ export declare function getAreas(): Area[]; /** * Get an area by its name * @param name Area name (case-insensitive) * @returns Area object or undefined if not found * @example * ```ts * import { getAreaByName } from 'kenya-locations/areas'; * const gigiri = getAreaByName('Gigiri'); * ``` */ export declare function getAreaByName(name: string): Area | undefined; /** * Get all areas in a locality * @param localityName Locality name * @returns Array of areas in the locality * @example * ```ts * import { getAreasInLocality } from 'kenya-locations/areas'; * const westlandsAreas = getAreasInLocality('Westlands'); * ``` */ export declare function getAreasInLocality(localityName: string): Area[]; /** * Get all areas in a county * @param countyName County name * @returns Array of areas in the county * @example * ```ts * import { getAreasInCounty } from 'kenya-locations/areas'; * const nairobiAreas = getAreasInCounty('Nairobi'); * ``` */ export declare function getAreasInCounty(countyName: string): Area[]; /** * Get the county of an area * @param areaName The name of the area * @returns County object or undefined if not found * @example * ```ts * import { getCountyOfArea } from 'kenya-locations/areas'; * const county = getCountyOfArea('Gigiri'); * ``` */ export declare function getCountyOfArea(areaName: string): County | undefined; /** * Get the locality of an area * @param areaName The name of the area * @returns Locality object or undefined if not found * @example * ```ts * import { getLocalityOfArea } from 'kenya-locations/areas'; * const locality = getLocalityOfArea('Gigiri'); * ``` */ export declare function getLocalityOfArea(areaName: string): Locality | undefined; /** * Get all areas matching a name across all localities. * Useful when the same area name exists in more than one locality. * @param name Area name (case-insensitive) * @returns Array of Area objects * @example * ```ts * import { getAreasByName } from 'kenya-locations/areas'; * const allTown = getAreasByName('Town'); * ``` */ export declare function getAreasByName(name: string): Area[]; export type { Area };