UNPKG

kenya-locations

Version:

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

82 lines (81 loc) 2.66 kB
import { Ward, County, SubCounty } from './types'; import { ConstituencyWrapper } from './constituencies'; /** * Get all wards * @returns Array of all wards * @example * ```ts * import { getWards } from 'kenya-locations/wards'; * const wards = getWards(); * ``` */ export declare function getWards(): Ward[]; /** * Get a ward by code * @param code Ward code * @returns Ward object or undefined if not found * @example * ```ts * import { getWardByCode } from 'kenya-locations/wards'; * const ward = getWardByCode('0001'); * ``` */ export declare function getWardByCode(code: string): Ward | undefined; /** * Get a ward by name (case-insensitive) * Note: Multiple wards may have the same name in different constituencies * @param name Ward name * @returns Ward object or undefined if not found * @example * ```ts * import { getWardByName } from 'kenya-locations/wards'; * const ward = getWardByName('Mountain View'); * ``` */ export declare function getWardByName(name: string): Ward | undefined; /** * Get all wards in a county * @param countyNameOrCode County name or code * @returns Array of wards in the county * @example * ```ts * import { getWardsInCounty } from 'kenya-locations/wards'; * const wardsInNairobi = getWardsInCounty('Nairobi'); * ``` */ export declare function getWardsInCounty(countyNameOrCode: string): Ward[]; /** * Get the county that a ward belongs to by ward name or code * @param wardNameOrCode Ward name or code * @returns County object or undefined if not found * @example * ```ts * import { getCountyOfWard } from 'kenya-locations/wards'; * const county = getCountyOfWard('0001'); * ``` */ export declare function getCountyOfWard(wardNameOrCode: string): County | undefined; /** * Get the constituency a ward belongs to by ward name or code * @param wardNameOrCode Ward name or code * @returns ConstituencyWrapper or undefined if not found * @example * ```ts * import { getConstituencyOfWard } from 'kenya-locations/wards'; * const constituency = getConstituencyOfWard('0001'); * ``` */ export declare function getConstituencyOfWard(wardNameOrCode: string): ConstituencyWrapper | undefined; /** * Get the sub-county a ward belongs to by ward name or code. * Sub-county names correspond to constituency names in the ward dataset. * @param wardNameOrCode Ward name or code * @returns SubCounty or undefined if not found * @example * ```ts * import { getSubCountyOfWard } from 'kenya-locations/wards'; * const subCounty = getSubCountyOfWard('0001'); * ``` */ export declare function getSubCountyOfWard(wardNameOrCode: string): SubCounty | undefined; export type { Ward };