Skip to content

Commit

Permalink
1342: replace foreach with reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
sinejespersen committed May 28, 2024
1 parent de565e4 commit f82c3b4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/travel-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"id": "01FZD7K807VAKZ99BGSSCHRJM6",
"description": "Skabelon til rejseplanen.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/travel.js?ts=1716556232231",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/travel-admin.json?ts=1716556232231",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/travel.js?ts=1716881579494",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/travel-admin.json?ts=1716881579494",
"schema": "",
"assets": [],
"options": {},
Expand Down
4 changes: 2 additions & 2 deletions build/travel-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"id": "01FZD7K807VAKZ99BGSSCHRJM6",
"description": "Skabelon til rejseplanen.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/travel.js?ts=1716556232231",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/travel-admin.json?ts=1716556232231",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/travel.js?ts=1716881579494",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/travel-admin.json?ts=1716881579494",
"schema": "",
"assets": [],
"options": {},
Expand Down
2 changes: 1 addition & 1 deletion build/travel.js

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions src/travel/travel.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,7 @@ function Travel({ slide, content, run, slideDone, executionId }) {
return "";
}

let ids = "";
if (station && station.length > 0) {
// To create this string: "id@id@id@"
station.forEach(({ id }) => {
ids += `${id}@`;
});
}
return ids;
return station.reduce((carry, { id }) => `${carry}${id}@`, "");
};

const imageStyle = {};
Expand Down

0 comments on commit f82c3b4

Please sign in to comment.