Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

db-stations-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-stations-autocomplete

Search for stations of DB.

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
57K
decreased by-17.71%
Maintainers
1
Weekly downloads
 
Created
Source

db-stations-autocomplete

db-stations-autocomplete provides a stations search for Deutsche Bahn. Pulls its data from db-stations@4 (There's also db-hafas-stations-autocomplete, which pulls its data from db-hafas-stations).

npm version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me on Twitter

Installing

npm install db-stations-autocomplete

Usage

autocomplete(query, results = 3, fuzzy = false, completion = true)
import {autocomplete} from 'db-stations-autocomplete'

autocomplete('Münch', 3)

This returns stations in a reduced form of the Friendly Public Transport Format. To get all details, pass use db-stations.

[ {
	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
} ]

If you set fuzzy to true, words with a Levenshtein distance <= 3 will be taken into account. This is a lot slower though (Apple M1, Node v19.1):

testperformance
non-fuzzy – berlin charlottenburg704 ops/sec
fuzzy – berlin charlottenbrug (note the typo)204 ops/sec

Setting completion to false speeds things up:

testperformance
completion – Münc Hbf477 ops/sec
no completion – Münc Hbf2115 ops/sec

Contributing

If you have a question or need support using db-stations-autocomplete, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use the issues page.

Keywords

FAQs

Package last updated on 28 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc