china-address-search
Version:
30 lines • 1.08 kB
TypeScript
export interface AddressItem {
code: string;
name: string;
spellCode: string;
children?: AddressItem[];
}
export interface AddressIteration {
node: AddressItem;
path: AddressItem[];
}
export interface MatchFragment {
text: string;
matched: boolean;
}
export interface AddressSearchResult {
fragments: MatchFragment[];
addressInfo: AddressIteration;
}
export declare type PrefixProvider = (leafNode: AddressItem) => IterableIterator<string>;
export declare type Char = string;
export declare function prefixQuery(input: string, getPrefixes: PrefixProvider, addressData: Iterable<AddressIteration>): Generator<{
addressInfo: AddressIteration;
fragments: MatchFragment[];
}, void, unknown>;
export declare function queryAddress(input: string, addressData?: AddressItem[]): Generator<{
addressInfo: AddressIteration;
fragments: MatchFragment[];
}, void, unknown>;
export declare function takeResult(iterator: IterableIterator<AddressSearchResult>, pageSize: number): AddressSearchResult[];
//# sourceMappingURL=index.d.ts.map