@digitransit-search-util/digitransit-search-util-get-geocoding-results 0.0.1 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -0
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const DEFAULT_PELIAS_URL = 'https://api.digitransit.fi/geocoding/v1/search';
|
|
|
11
11
|
* @param {Object} focusPoint (Optional) Own Position (PELIAS API)
|
|
12
12
|
* @param {String} sources (Optional) search sources (e.g OSM, GTFS..)
|
|
13
13
|
* @param {Object} minimalRegexp (Optional) Regexp for testing
|
|
14
|
+
* @param {*} geocodingLayers (Optional) Array of strings that is used to determine which layers is searched, e.g. ['venue', 'address', 'stop']
|
|
14
15
|
* @returns {String} Results in JSON form
|
|
15
16
|
* @example
|
|
16
17
|
* digitransit-search-util.getGeocodingResults("result");
|
|
@@ -24,6 +25,7 @@ export default function getGeocodingResults(
|
|
|
24
25
|
sources,
|
|
25
26
|
peliasUrl,
|
|
26
27
|
minimalRegexp,
|
|
28
|
+
geocodingLayers,
|
|
27
29
|
) {
|
|
28
30
|
const text = searchString ? searchString.trim() : null;
|
|
29
31
|
if (
|
|
@@ -39,6 +41,10 @@ export default function getGeocodingResults(
|
|
|
39
41
|
if (sources) {
|
|
40
42
|
opts = { ...opts, sources };
|
|
41
43
|
}
|
|
44
|
+
if (geocodingLayers) {
|
|
45
|
+
const layers = geocodingLayers.toString();
|
|
46
|
+
opts = { ...opts, layers };
|
|
47
|
+
}
|
|
42
48
|
return getJson(PELIAS_URL, opts).then(res => {
|
|
43
49
|
return res.features;
|
|
44
50
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitransit-search-util/digitransit-search-util-get-geocoding-results",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "digitransit-search-util get-geocoding-results module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "Digitransit Authors",
|
|
22
22
|
"license": "(AGPL-3.0 OR EUPL-1.2)",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@digitransit-search-util/digitransit-search-util-get-json": "
|
|
24
|
+
"@digitransit-search-util/digitransit-search-util-get-json": "0.0.4"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "6c0aa6181caed7a3b53aa5ec17b593e808e5a88f"
|
|
27
27
|
}
|