Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/search-flix-locations
Search for Flix/Flixbus/MeinFernbus cities & stations.
https://github.com/derhuerst/search-flix-locations
bus coach flixbus flixtrain meinfernbus public-transport search transit
Last synced: 6 days ago
JSON representation
Search for Flix/Flixbus/MeinFernbus cities & stations.
- Host: GitHub
- URL: https://github.com/derhuerst/search-flix-locations
- Owner: derhuerst
- License: isc
- Created: 2016-08-20T02:46:43.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-12T04:28:08.000Z (over 4 years ago)
- Last Synced: 2024-10-03T23:53:24.084Z (about 1 month ago)
- Topics: bus, coach, flixbus, flixtrain, meinfernbus, public-transport, search, transit
- Language: JavaScript
- Homepage: https://github.com/derhuerst/search-flix-locations
- Size: 54.7 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# *search-flix-locations*
**Search for [Flix/Flixbus/Meinfernbus](https://flixbus.de/) regions & stations.**
[![asciicast](https://asciinema.org/a/181177.png)](https://asciinema.org/a/181177)
[![npm version](https://img.shields.io/npm/v/search-flix-locations.svg)](https://www.npmjs.com/package/search-flix-locations)
[![build status](https://img.shields.io/travis/derhuerst/search-flix-locations.svg)](https://travis-ci.org/derhuerst/search-flix-locations)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/search-flix-locations.svg)
[![chat on gitter](https://badges.gitter.im/derhuerst.svg)](https://gitter.im/derhuerst)
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)## Installing
```shell
npm install search-flix-locations
```## Usage
```js
autocomplete(query, limit = 6, fuzzy = false, completion = true)
``````js
const pick = require('lodash.pick')
const search = require('search-flix-locations')console.log(search('berlin', 5))
``````js
[ {
id: '88',
name: 'Berlin',
type: 'region',
relevance: 3.455855112783178,
score: 27.984681385568972,
weight: 531
}, {
id: '1224',
name: 'Berlin Alexanderplatz',
type: 'station',
relevance: 1.727927556391589,
score: 7.743542752920189,
weight: 90
}, {
id: '481',
name: 'Berlin Südkreuz',
type: 'station',
relevance: 1.727927556391589,
score: 7.445414138704126,
weight: 80
}, {
id: '471',
name: 'Berlin SXF',
type: 'station',
relevance: 1.727927556391589,
score: 7.121282437290776,
weight: 70
}, {
id: '2825',
name: 'Berlin Zoo',
type: 'station',
relevance: 1.727927556391589,
score: 5.369072671153364,
weight: 30
} ]
```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.
## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/search-flix-locations/issues).