mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-06 18:00:35 +02:00
120 lines
3.3 KiB
Markdown
120 lines
3.3 KiB
Markdown
# @digitransit-search-util/digitransit-search-util-query-utils
|
|
|
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
|
|
## verify
|
|
|
|
Verifies that the data for favourites is coherent and current and fixes errors
|
|
|
|
### Parameters
|
|
|
|
- `stopStationMap`
|
|
- `favourites`
|
|
|
|
## setRelayEnvironment
|
|
|
|
Set you Relay environment
|
|
|
|
### Parameters
|
|
|
|
- `environment` **any** Your Relay environment
|
|
|
|
## getModesWithAlerts
|
|
|
|
Get alerts for modes
|
|
|
|
### Parameters
|
|
|
|
- `currentTime` **[Number][1]** Epoch time
|
|
- `feedIds` **[Array][2]** Array of feedId Strings (optional, default `null`)
|
|
|
|
## getStopAndStationsQuery
|
|
|
|
Returns Stop and station objects .
|
|
|
|
### Parameters
|
|
|
|
- `favourites` **any**
|
|
|
|
## filterStopsAndStationsByMode
|
|
|
|
Returns Stop and station objects filtered by given mode based on mode information
|
|
acquired from OTP by checking the modes of the departures on the given stops.
|
|
|
|
### Parameters
|
|
|
|
- `stopsToFilter` **any**
|
|
- `mode` **[String][3]**
|
|
|
|
## getFavouriteRoutesQuery
|
|
|
|
Returns Favourite Route objects depending on input
|
|
|
|
### Parameters
|
|
|
|
- `favourites` **any**
|
|
- `input` **[String][3]** Search text, if empty no objects are returned
|
|
- `transportMode` **[String][3]** If provided, all returned route objects are of this mode, e.g. 'BUS'
|
|
- `pathOpts` an object containing two properties routesPrefix and stopsPrefix to override the URL paths returned
|
|
by this method
|
|
|
|
## getFavouriteVehicleRentalStationsQuery
|
|
|
|
Returns Favourite VehicleRentalStation objects depending on input
|
|
|
|
### Parameters
|
|
|
|
- `favourites` **any**
|
|
- `input` **[String][3]** Search text, if empty no objects are returned
|
|
|
|
## getRoutesQuery
|
|
|
|
Returns Route objects depending on input
|
|
|
|
### Parameters
|
|
|
|
- `input` **[String][3]** Search text, if empty no objects are returned
|
|
- `feedIds` **any**
|
|
- `transportMode` **[String][3]** Filter routes with a transport mode, e.g. route-BUS
|
|
- `pathOpts` an object containing two properties routesPrefix and stopsPrefix to override the URL paths returned
|
|
by this method
|
|
|
|
## filterSearchResultsByMode
|
|
|
|
Can be used to filter stops and stations by a given mode
|
|
|
|
### Parameters
|
|
|
|
- `results` **any** search results from geocoding
|
|
- `mode` **any** e.g 'BUS' or 'TRAM'
|
|
- `type` **any** type of search results to filter, e.g 'Stops' or 'Routes'. This function only filters Stops because routes can be filtered with the query itself (optional, default `'Stops'`)
|
|
|
|
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
|
|
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
|
|
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
|
|
<!-- This file is automatically generated. Please don't edit it directly:
|
|
if you find an error, edit the source file (likely index.js), and re-run
|
|
./scripts/generate-readmes in the digitransit-search-util project. -->
|
|
|
|
---
|
|
|
|
This module is part of the Digitransit-ui project. It is maintained in the
|
|
[HSLdevcom/digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) repository, where you can create
|
|
PRs and issues.
|
|
|
|
### Installation
|
|
|
|
Install this module individually:
|
|
|
|
```sh
|
|
$ npm install @digitransit-search-util/digitransit-search-util-query-utils
|
|
```
|
|
|
|
Or install the digitransit-search-util module that includes it as a function:
|
|
|
|
```sh
|
|
$ npm install @digitransit-search-util/digitransit-search-util
|
|
```
|