@digitransit-search-util/digitransit-search-util-is-duplicate 0.0.4 → 0.0.8
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 +22 -7
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -35,15 +35,22 @@ export default function isDuplicate(item1, item2) {
|
|
|
35
35
|
const name1 = `${o1.name}//${o1.locality}//${d1.name}//${d1.locality}`;
|
|
36
36
|
const name2 = `${o2.name}//${o2.locality}//${d2.name}//${d2.locality}`;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return false;
|
|
42
|
-
} else if (item1.type === 'FutureRoute' || item2.type === 'FutureRoute') {
|
|
38
|
+
return name1 === name2;
|
|
39
|
+
}
|
|
40
|
+
if (item1.type === 'FutureRoute' || item2.type === 'FutureRoute') {
|
|
43
41
|
return false;
|
|
44
42
|
}
|
|
45
|
-
if (
|
|
46
|
-
|
|
43
|
+
if (
|
|
44
|
+
((props1.layer === 'bikeRentalStation' ||
|
|
45
|
+
props1.layer === 'favouriteBikeRentalStation') &&
|
|
46
|
+
(props2.layer === 'bikeRentalStation' ||
|
|
47
|
+
props2.layer === 'favouriteBikeRentalStation')) ||
|
|
48
|
+
(props1.layer === 'bikestation' && props2.layer === 'bikestation')
|
|
49
|
+
) {
|
|
50
|
+
return props1.labelId === props2.labelId;
|
|
51
|
+
}
|
|
52
|
+
if (props1.gtfsId && props2.gtfsId) {
|
|
53
|
+
return props1.gtfsId === props2.gtfsId;
|
|
47
54
|
}
|
|
48
55
|
if (props1.gtfsId && props2.gid && props2.gid.includes(props1.gtfsId)) {
|
|
49
56
|
return true;
|
|
@@ -51,6 +58,14 @@ export default function isDuplicate(item1, item2) {
|
|
|
51
58
|
if (props2.gtfsId && props1.gid && props1.gid.includes(props2.gtfsId)) {
|
|
52
59
|
return true;
|
|
53
60
|
}
|
|
61
|
+
if (
|
|
62
|
+
(props1.layer === 'stop' || props1.layer === 'station') &&
|
|
63
|
+
(props2.layer === 'stop' || props2.layer === 'station') &&
|
|
64
|
+
props1.gid &&
|
|
65
|
+
props2.gid
|
|
66
|
+
) {
|
|
67
|
+
return props1.gid === props2.gid;
|
|
68
|
+
}
|
|
54
69
|
|
|
55
70
|
const p1 = item1 && item1.geometry ? item1.geometry.coordinates : undefined;
|
|
56
71
|
const p2 = item2 && item2.geometry ? item2.geometry.coordinates : undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitransit-search-util/digitransit-search-util-is-duplicate",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "digitransit-search-util is-duplicate 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-tru-eq": "0.0.
|
|
24
|
+
"@digitransit-search-util/digitransit-search-util-tru-eq": "0.0.2"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "7b26c6654a58951bd14f1794a632007817a6e48d"
|
|
27
27
|
}
|