Installation
npm install --save @types/db-stations-autocomplete
Summary
This package contains type definitions for db-stations-autocomplete (https://github.com/derhuerst/db-stations-autocomplete).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/db-stations-autocomplete.
index.d.ts
export = autocomplete;
/**
* Provides a stations search for [Deutsche Bahn](https://en.wikipedia.org/wiki/Deutsche_Bahn).
* Pulls its data from [`db-stations`](https://github.com/derhuerst/db-stations).
*
* @example
* import autocomplete = require('db-stations-autocomplete')
*
* autocomplete('Münch', 3)
* // =>
* // [ {
* // id: '8000261', // München Hbf
* // relevance: 0.8794466403162056,
* // score: 11.763480191996974,
* // weight: 2393.2
* // }, {
* // id: '8004128', // München Donnersbergerbrücke
* // relevance: 0.8794466403162056,
* // score: 9.235186720706798,
* // weight: 1158
* // }, {
* // id: '8004132', // München Karlsplatz
* // relevance: 0.8794466403162056,
* // score: 9.144716179768407,
* // weight: 1124.3
* // } ]
*/
declare function autocomplete(
query: string,
/** @default 3 */
results?: number,
/**
* If you set `fuzzy` to `true`, words with a
* [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) `<= 3` will be taken into account.
* This is a lot slower though.
*
* @default false
*/
fuzzy?: boolean,
/**
* Setting `completion` to `false` speeds things up.
*
* @default true
*/
completion?: boolean,
): autocomplete.Result[];
declare namespace autocomplete {
interface Result {
id: string;
relevance: number;
score: number;
weight: number;
}
}
Additional Details
- Last updated: Mon, 06 Nov 2023 22:41:05 GMT
- Dependencies: none
Credits
These definitions were written by Freerk-Ole Zakfeld, and BendingBender.