From ffdb6c272b6a38ceed18986c4fa4cefb5ed7256c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= Date: Fri, 7 Feb 2020 14:27:07 +0100 Subject: [PATCH] client: s/var/let/g --- client/js/app_functions.js | 2 +- client/js/journeyView.js | 4 ++-- client/js/journeysView.js | 12 ++++++------ client/js/searchView.js | 2 +- client/js/sprintf.min.js | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/js/app_functions.js b/client/js/app_functions.js index cd1de77..3126543 100644 --- a/client/js/app_functions.js +++ b/client/js/app_functions.js @@ -89,7 +89,7 @@ export const getCache = (mode, reqId) => { }; export const t = (key, params) => { - var language = 'en'; + let language = 'en'; if (dataStorage.settings.language !== undefined) { language = dataStorage.settings.language; diff --git a/client/js/journeyView.js b/client/js/journeyView.js index d171714..1fb801f 100644 --- a/client/js/journeyView.js +++ b/client/js/journeyView.js @@ -9,7 +9,7 @@ import { html, render } from './lit-html.js'; const journeyTemplate = (data, requestId, journeyId) => { let departure = data.legs[0].departure; let arrival = data.legs[data.legs.length - 1].arrival; - var changes = 0; + let changes = 0; let departureTime = departure.prognosedTime ? departure.prognosedTime : departure.plannedTime; let arrivalTime = arrival.prognosedTime ? arrival.prognosedTime : arrival.plannedTime; @@ -89,7 +89,7 @@ const journeyTemplate = (data, requestId, journeyId) => { `}; const timeTemplate = (data, mode) => { - var delay = 0; + let delay = 0; if (data.prognosedTime !== null) { delay = (data.prognosedTime - data.plannedTime)/60; diff --git a/client/js/journeysView.js b/client/js/journeysView.js index 1810b84..83042a2 100644 --- a/client/js/journeysView.js +++ b/client/js/journeysView.js @@ -46,10 +46,10 @@ const journeysTemplate = (data) => html` const journeyOverviewTemplate = (data, key) => { let departure = data.journeys[key].legs[0].departure; let arrival = data.journeys[key].legs[data.journeys[key].legs.length - 1].arrival; - var changes = 0; - var products = []; - var changesDuration = 0; - var cancelled = false; + let changes = 0; + let products = []; + let changesDuration = 0; + let cancelled = false; let departureTime = departure.prognosedTime ? departure.prognosedTime : departure.plannedTime; let arrivalTime = arrival.prognosedTime ? arrival.prognosedTime : arrival.plannedTime; @@ -94,7 +94,7 @@ export const journeysView = async (match) => { }; const timeTemplate = (data, mode) => { - var delay = 0; + let delay = 0; if (data.prognosedTime !== null) { delay = (data.prognosedTime - data.plannedTime)/60; @@ -109,7 +109,7 @@ const timeTemplate = (data, mode) => { } export const moreJourneys = async (reqId, mode) => { - var data = getCache('journeys', reqId); + let data = getCache('journeys', reqId); const newData = await get('/moreJourneys', {"reqId": reqId, "mode": mode}); data.lastUpdated = newData.lastUpdated; diff --git a/client/js/searchView.js b/client/js/searchView.js index c02d22c..bfdf9e7 100644 --- a/client/js/searchView.js +++ b/client/js/searchView.js @@ -262,7 +262,7 @@ export const setFromHistory = (id) => { }; export const readProductSelection = () => { - var products = { + let products = { "nationalExp": false, "national": false, "regionalExp": false, diff --git a/client/js/sprintf.min.js b/client/js/sprintf.min.js index 92c13a7..a3dce30 100644 --- a/client/js/sprintf.min.js +++ b/client/js/sprintf.min.js @@ -1,6 +1,6 @@ 'use strict' - var re = { + let re = { not_string: /[^s]/, not_bool: /[^t]/, not_type: /[^T]/, @@ -28,7 +28,7 @@ } function sprintf_format(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign + let cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, ph, pad, pad_character, pad_length, is_positive, sign for (i = 0; i < tree_length; i++) { if (typeof parse_tree[i] === 'string') { output += parse_tree[i] @@ -136,14 +136,14 @@ return output } - var sprintf_cache = Object.create(null) + let sprintf_cache = Object.create(null) function sprintf_parse(fmt) { if (sprintf_cache[fmt]) { return sprintf_cache[fmt] } - var _fmt = fmt, match, parse_tree = [], arg_names = 0 + let _fmt = fmt, match, parse_tree = [], arg_names = 0 while (_fmt) { if ((match = re.text.exec(_fmt)) !== null) { parse_tree.push(match[0]) @@ -154,7 +154,7 @@ else if ((match = re.placeholder.exec(_fmt)) !== null) { if (match[2]) { arg_names |= 1 - var field_list = [], replacement_field = match[2], field_match = [] + let field_list = [], replacement_field = match[2], field_match = [] if ((field_match = re.key.exec(replacement_field)) !== null) { field_list.push(field_match[1]) while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {