UNPKG

kenya-locations

Version:

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

50 lines (49 loc) 1.55 kB
import { SearchResult, SearchType } from './types'; /** * Search options interface */ export interface SearchOptions { /** Maximum number of results to return */ limit?: number; /** Types of locations to search */ types?: SearchType[]; } /** * Search for counties, constituencies, wards, localities, or areas * @param query Search query string * @param options Search options (limit and types) * @returns Array of search results * @example * ```ts * import { search } from 'kenya-locations/search'; * * // Search all types * const results = search('Nairobi'); * * // Search with limit * const limited = search('Nairobi', { limit: 5 }); * * // Search specific types * const counties = search('Nairobi', { types: ['county'] }); * * // Combine options * const results = search('West', { limit: 10, types: ['locality', 'area'] }); * ``` */ export declare function search(query: string, options?: SearchOptions): SearchResult[]; /** * Search for a specific type of administrative division * @param query Search query string * @param type Type of location to search for * @param limit Maximum number of results (optional) * @returns Array of search results * @example * ```ts * import { searchByType } from 'kenya-locations/search'; * * const counties = searchByType('Nairob', 'county', 5); * const localities = searchByType('West', 'locality', 10); * ``` */ export declare function searchByType(query: string, type: SearchType, limit?: number): SearchResult[]; export type { SearchResult, SearchType };