@types/db-stations-autocomplete
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/db-stations-autocomplete

Weekly Downloads

0

Version

3.0.2

License

MIT

Unpacked Size

5.89 kB

Total Files

5

Last publish

Collaborators

  • types