Skip to content

Commit

Permalink
Enrich the data structure of ETA
Browse files Browse the repository at this point in the history
  • Loading branch information
chunlaw committed Nov 19, 2023
1 parent 39f9f6c commit ddd3c01
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hk-bus-eta",
"version": "3.0.3",
"version": "3.1.0",
"description": "Query the ETA (Estimated Time of Arrival) of HK Bus/Minibus/MTR/Lightrail",
"main": "dist/index.js",
"module": "esm/index.js",
Expand Down
8 changes: 6 additions & 2 deletions src/ctb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ export default function fetchEtas({
.map((e: any) => ({
eta: e.eta,
remark: {
zh: `往${e.dest_tc} ${e.rmk_tc}`,
en: `to ${e.dest_en} ${e.rmk_en}`,
zh: e.rmk_tc,
en: e.rmk_en,
},
dest: {
zh: e.dest_tc,
en: e.dest_en,
},
co: "ctb",
})),
Expand Down
4 changes: 4 additions & 0 deletions src/gmb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default function fetchEtas({
zh: data.remarks_tc,
en: data.remarks_en,
},
dest: {
zh: "",
en: "",
},
co: "gmb",
})),
],
Expand Down
8 changes: 6 additions & 2 deletions src/kmb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ export default function fetchEtas({
.map((e: any) => ({
eta: e.eta,
remark: {
zh: `往 ${e.dest_tc} ${e.rmk_tc}`,
en: `to ${e.dest_en} ${e.rmk_en}`,
zh: e.rmk_tc,
en: e.rmk_en,
},
dest: {
zh: e.dest_tc,
en: e.dest_en,
},
co: "kmb",
})),
Expand Down
4 changes: 4 additions & 0 deletions src/lightRail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default function fetchEtas({
.fill("▭")
.join("")}`,
},
dest: {
zh: '',
en: '',
},
co: "lightRail",
};
}, []),
Expand Down
4 changes: 4 additions & 0 deletions src/lrtfeeder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export default function fetchEtas({
: "預定班次"
: ""),
},
dest: {
zh: '',
en: '',
},
co: "lrtfeeder",
},
];
Expand Down
8 changes: 6 additions & 2 deletions src/mtr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export default function fetchEtas({
{
eta: time.replace(" ", "T") + "+08:00",
remark: {
zh: `${plat}號月台 往${stopList[dest].name.zh}`,
en: `Platform ${plat} to ${stopList[dest].name.en}`,
zh: `${plat}號月台`,
en: `Platform ${plat}`,
},
dest: {
zh: stopList[dest].name.zh,
en: stopList[dest].name.en,
},
co: "mtr",
},
Expand Down
4 changes: 4 additions & 0 deletions src/nlb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default function fetchEtas({
zh: "",
en: "",
},
dest: {
zh: "",
en: "",
},
co: "nlb",
}));
});
Expand Down
4 changes: 4 additions & 0 deletions src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,9 @@ export type Eta = {
zh: string;
en: string;
};
dest: {
zh: string;
en: string;
};
co: Company;
};

0 comments on commit ddd3c01

Please sign in to comment.