From b365ce319569196aff0de36a24963f6eef664ea1 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Wed, 3 May 2017 00:40:39 +0100 Subject: [PATCH] fix the first 100 prefer-const errors --- src/web/ControlsWaiter.js | 86 ++++++++++++++++++------------------ src/web/HTMLIngredient.js | 15 +++---- src/web/HighlighterWaiter.js | 56 +++++++++++------------ src/web/InputWaiter.js | 18 ++++---- src/web/Manager.js | 15 ++++--- src/web/OperationsWaiter.js | 42 ++++++++---------- src/web/OptionsWaiter.js | 12 ++--- src/web/OutputWaiter.js | 22 ++++----- src/web/RecipeWaiter.js | 13 +++--- test/index.js | 8 ++-- 10 files changed, 141 insertions(+), 146 deletions(-) diff --git a/src/web/ControlsWaiter.js b/src/web/ControlsWaiter.js index 1af61e74..26038364 100755 --- a/src/web/ControlsWaiter.js +++ b/src/web/ControlsWaiter.js @@ -23,14 +23,14 @@ const ControlsWaiter = function(app, manager) { * without wrapping or overflowing. */ ControlsWaiter.prototype.adjustWidth = function() { - let controls = document.getElementById("controls"), - step = document.getElementById("step"), - clrBreaks = document.getElementById("clr-breaks"), - saveImg = document.querySelector("#save img"), - loadImg = document.querySelector("#load img"), - stepImg = document.querySelector("#step img"), - clrRecipImg = document.querySelector("#clr-recipe img"), - clrBreaksImg = document.querySelector("#clr-breaks img"); + const controls = document.getElementById("controls"); + const step = document.getElementById("step"); + const clrBreaks = document.getElementById("clr-breaks"); + const saveImg = document.querySelector("#save img"); + const loadImg = document.querySelector("#load img"); + const stepImg = document.querySelector("#step img"); + const clrRecipImg = document.querySelector("#clr-recipe img"); + const clrBreaksImg = document.querySelector("#clr-breaks img"); if (controls.clientWidth < 470) { step.childNodes[1].nodeValue = " Step"; @@ -100,8 +100,8 @@ ControlsWaiter.prototype.stepClick = function() { * Handler for changes made to the Auto Bake checkbox. */ ControlsWaiter.prototype.autoBakeChange = function() { - let autoBakeLabel = document.getElementById("auto-bake-label"), - autoBakeCheckbox = document.getElementById("auto-bake"); + const autoBakeLabel = document.getElementById("auto-bake-label"); + const autoBakeCheckbox = document.getElementById("auto-bake"); this.app.autoBake_ = autoBakeCheckbox.checked; @@ -145,10 +145,10 @@ ControlsWaiter.prototype.clearBreaksClick = function() { ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) { recipeConfig = recipeConfig || this.app.getRecipeConfig(); - let includeRecipe = document.getElementById("save-link-recipe-checkbox").checked, - includeInput = document.getElementById("save-link-input-checkbox").checked, - saveLinkEl = document.getElementById("save-link"), - saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig); + const includeRecipe = document.getElementById("save-link-recipe-checkbox").checked; + const includeInput = document.getElementById("save-link-input-checkbox").checked; + const saveLinkEl = document.getElementById("save-link"); + const saveLink = this.generateStateUrl(includeRecipe, includeInput, recipeConfig); saveLinkEl.innerHTML = Utils.truncate(saveLink, 120); saveLinkEl.setAttribute("href", saveLink); @@ -167,23 +167,27 @@ ControlsWaiter.prototype.initialiseSaveLink = function(recipeConfig) { ControlsWaiter.prototype.generateStateUrl = function(includeRecipe, includeInput, recipeConfig, baseURL) { recipeConfig = recipeConfig || this.app.getRecipeConfig(); - let link = baseURL || window.location.protocol + "//" + + const link = baseURL || window.location.protocol + "//" + window.location.host + - window.location.pathname, - recipeStr = JSON.stringify(recipeConfig), - inputStr = Utils.toBase64(this.app.getInput(), "A-Za-z0-9+/"); // B64 alphabet with no padding + window.location.pathname; + const recipeStr = JSON.stringify(recipeConfig); + const inputStr = Utils.toBase64(this.app.getInput(), "A-Za-z0-9+/"); // B64 alphabet with no padding - includeRecipe = includeRecipe && (recipeConfig.length > 0); - includeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000); + const myIncludeRecipe = includeRecipe && (recipeConfig.length > 0); + const myIncludeInput = includeInput && (inputStr.length > 0) && (inputStr.length < 8000); - if (includeRecipe) { - link += "?recipe=" + encodeURIComponent(recipeStr); - } + const params = [ + myIncludeRecipe ? ["recipe", recipeStr] : undefined, + myIncludeInput ? ["input", inputStr] : undefined, + ]; - if (includeRecipe && includeInput) { - link += "&input=" + encodeURIComponent(inputStr); - } else if (includeInput) { - link += "?input=" + encodeURIComponent(inputStr); + const query = params + .filter(v => v) + .map(([key, value]) => `${key}=${encodeURIComponent(value)}`) + .join("&"); + + if (query) { + return `${link}?${query}`; } return link; @@ -205,8 +209,8 @@ ControlsWaiter.prototype.saveTextChange = function() { * Handler for the 'Save' command. Pops up the save dialog box. */ ControlsWaiter.prototype.saveClick = function() { - let recipeConfig = this.app.getRecipeConfig(), - recipeStr = JSON.stringify(recipeConfig).replace(/},{/g, "},\n{"); + const recipeConfig = this.app.getRecipeConfig(); + const recipeStr = JSON.stringify(recipeConfig).replace(/},{/g, "},\n{"); document.getElementById("save-text").value = recipeStr; @@ -303,13 +307,11 @@ ControlsWaiter.prototype.populateLoadRecipesList = function() { * Removes the currently selected recipe from local storage. */ ControlsWaiter.prototype.loadDeleteClick = function() { - let id = parseInt(document.getElementById("load-name").value, 10), - savedRecipes = localStorage.savedRecipes ? + const id = parseInt(document.getElementById("load-name").value, 10); + const rawSavedRecipes = localStorage.savedRecipes ? JSON.parse(localStorage.savedRecipes) : []; - savedRecipes = savedRecipes.filter(function(r) { - return r.id !== id; - }); + const savedRecipes = rawSavedRecipes.filter(r => r.id !== id); localStorage.savedRecipes = JSON.stringify(savedRecipes); this.populateLoadRecipesList(); @@ -320,14 +322,12 @@ ControlsWaiter.prototype.loadDeleteClick = function() { * Displays the selected recipe in the load text box. */ ControlsWaiter.prototype.loadNameChange = function(e) { - let el = e.target, - savedRecipes = localStorage.savedRecipes ? - JSON.parse(localStorage.savedRecipes) : [], - id = parseInt(el.value, 10); + const el = e.target; + const savedRecipes = localStorage.savedRecipes ? + JSON.parse(localStorage.savedRecipes) : []; + const id = parseInt(el.value, 10); - const recipe = savedRecipes.filter(function(r) { - return r.id === id; - })[0]; + const recipe = savedRecipes.find(r => r.id === id); document.getElementById("load-text").value = recipe.recipe; }; @@ -352,8 +352,8 @@ ControlsWaiter.prototype.loadButtonClick = function() { * Populates the bug report information box with useful technical info. */ ControlsWaiter.prototype.supportButtonClick = function() { - let reportBugInfo = document.getElementById("report-bug-info"), - saveLink = this.generateStateUrl(true, true, null, "https://gchq.github.io/CyberChef/"); + const reportBugInfo = document.getElementById("report-bug-info"); + const saveLink = this.generateStateUrl(true, true, null, "https://gchq.github.io/CyberChef/"); reportBugInfo.innerHTML = "* CyberChef compile time: " + COMPILE_TIME + "\n" + "* User-Agent: \n" + navigator.userAgent + "\n" + diff --git a/src/web/HTMLIngredient.js b/src/web/HTMLIngredient.js index 34bf547b..3f360f04 100755 --- a/src/web/HTMLIngredient.js +++ b/src/web/HTMLIngredient.js @@ -158,13 +158,12 @@ HTMLIngredient.prototype.toHtml = function() { * @param {event} e */ HTMLIngredient.prototype.toggleDisableArgs = function(e) { - let el = e.target, - op = el.parentNode.parentNode, - args = op.querySelectorAll(".arg-group"), - els; + const el = e.target; + const op = el.parentNode.parentNode; + const args = op.querySelectorAll(".arg-group"); for (let i = 0; i < this.disableArgs.length; i++) { - els = args[this.disableArgs[i]].querySelectorAll("input, select, button"); + const els = args[this.disableArgs[i]].querySelectorAll("input, select, button"); for (let j = 0; j < els.length; j++) { if (els[j].getAttribute("disabled")) { @@ -186,9 +185,9 @@ HTMLIngredient.prototype.toggleDisableArgs = function(e) { * @param {event} e */ HTMLIngredient.prototype.populateOptionChange = function(e) { - let el = e.target, - op = el.parentNode.parentNode, - target = op.querySelectorAll(".arg-group")[this.target].querySelector("input, select, textarea"); + const el = e.target; + const op = el.parentNode.parentNode; + const target = op.querySelectorAll(".arg-group")[this.target].querySelector("input, select, textarea"); target.value = el.childNodes[el.selectedIndex].getAttribute("populate-value"); diff --git a/src/web/HighlighterWaiter.js b/src/web/HighlighterWaiter.js index 94d388c5..7c9b7e42 100755 --- a/src/web/HighlighterWaiter.js +++ b/src/web/HighlighterWaiter.js @@ -64,8 +64,8 @@ HighlighterWaiter.prototype._isSelectionBackwards = function() { * @returns {number} */ HighlighterWaiter.prototype._getOutputHtmlOffset = function(node, offset) { - let sel = window.getSelection(), - range = document.createRange(); + const sel = window.getSelection(); + const range = document.createRange(); range.selectNodeContents(document.getElementById("output-html")); range.setEnd(node, offset); @@ -85,8 +85,8 @@ HighlighterWaiter.prototype._getOutputHtmlOffset = function(node, offset) { * @returns {number} pos.end */ HighlighterWaiter.prototype._getOutputHtmlSelectionOffsets = function() { - let sel = window.getSelection(), - range, + const sel = window.getSelection(); + let range, start = 0, end = 0, backwards = false; @@ -151,9 +151,9 @@ HighlighterWaiter.prototype.inputMousedown = function(e) { this.mouseTarget = HighlighterWaiter.INPUT; this.removeHighlights(); - let el = e.target, - start = el.selectionStart, - end = el.selectionEnd; + const el = e.target; + const start = el.selectionStart; + const end = el.selectionEnd; if (start !== 0 || end !== 0) { document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end); @@ -173,9 +173,9 @@ HighlighterWaiter.prototype.outputMousedown = function(e) { this.mouseTarget = HighlighterWaiter.OUTPUT; this.removeHighlights(); - let el = e.target, - start = el.selectionStart, - end = el.selectionEnd; + const el = e.target; + const start = el.selectionStart; + const end = el.selectionEnd; if (start !== 0 || end !== 0) { document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end); @@ -244,9 +244,9 @@ HighlighterWaiter.prototype.inputMousemove = function(e) { this.mouseTarget !== HighlighterWaiter.INPUT) return; - let el = e.target, - start = el.selectionStart, - end = el.selectionEnd; + const el = e.target; + const start = el.selectionStart; + const end = el.selectionEnd; if (start !== 0 || end !== 0) { document.getElementById("input-selection-info").innerHTML = this.selectionInfo(start, end); @@ -268,9 +268,9 @@ HighlighterWaiter.prototype.outputMousemove = function(e) { this.mouseTarget !== HighlighterWaiter.OUTPUT) return; - let el = e.target, - start = el.selectionStart, - end = el.selectionEnd; + const el = e.target; + const start = el.selectionStart; + const end = el.selectionEnd; if (start !== 0 || end !== 0) { document.getElementById("output-selection-info").innerHTML = this.selectionInfo(start, end); @@ -308,11 +308,11 @@ HighlighterWaiter.prototype.outputHtmlMousemove = function(e) { * @returns {string} */ HighlighterWaiter.prototype.selectionInfo = function(start, end) { - let width = end.toString().length; - width = width < 2 ? 2 : width; - let startStr = Utils.pad(start.toString(), width, " ").replace(/ /g, " "), - endStr = Utils.pad(end.toString(), width, " ").replace(/ /g, " "), - lenStr = Utils.pad((end-start).toString(), width, " ").replace(/ /g, " "); + const len = end.toString().length; + const width = len < 2 ? 2 : len; + const startStr = Utils.pad(start.toString(), width, " ").replace(/ /g, " "); + const endStr = Utils.pad(end.toString(), width, " ").replace(/ /g, " "); + const lenStr = Utils.pad((end-start).toString(), width, " ").replace(/ /g, " "); return "start: " + startStr + "
end: " + endStr + "
length: " + lenStr; }; @@ -339,8 +339,8 @@ HighlighterWaiter.prototype.removeHighlights = function() { * @returns {Object[]} highlights[].args */ HighlighterWaiter.prototype.generateHighlightList = function() { - let recipeConfig = this.app.getRecipeConfig(), - highlights = []; + const recipeConfig = this.app.getRecipeConfig(); + const highlights = []; for (let i = 0; i < recipeConfig.length; i++) { if (recipeConfig[i].disabled) continue; @@ -452,11 +452,11 @@ HighlighterWaiter.prototype.highlight = function(textarea, highlighter, pos) { // be displayed by the HTML textarea and will mess up highlighting offsets. if (!this.app.dishStr || this.app.dishStr.indexOf("\r") >= 0) return false; - let startPlaceholder = "[startHighlight]", - startPlaceholderRegex = /\[startHighlight\]/g, - endPlaceholder = "[endHighlight]", - endPlaceholderRegex = /\[endHighlight\]/g, - text = textarea.value; + const startPlaceholder = "[startHighlight]"; + const startPlaceholderRegex = /\[startHighlight\]/g; + const endPlaceholder = "[endHighlight]"; + const endPlaceholderRegex = /\[endHighlight\]/g; + let text = textarea.value; // Put placeholders in position // If there's only one value, select that diff --git a/src/web/InputWaiter.js b/src/web/InputWaiter.js index f2e8a836..040716bb 100755 --- a/src/web/InputWaiter.js +++ b/src/web/InputWaiter.js @@ -92,8 +92,8 @@ InputWaiter.prototype.inputChange = function(e) { this.app.progress = 0; // Update the input metadata info - let inputText = this.get(), - lines = inputText.count("\n") + 1; + const inputText = this.get(); + const lines = inputText.count("\n") + 1; this.setInputInfo(inputText.length, lines); @@ -149,13 +149,13 @@ InputWaiter.prototype.inputDrop = function(e) { e.stopPropagation(); e.preventDefault(); - let el = e.target, - file = e.dataTransfer.files[0], - text = e.dataTransfer.getData("Text"), - reader = new FileReader(), - inputCharcode = "", - offset = 0, - CHUNK_SIZE = 20480; // 20KB + const el = e.target; + const file = e.dataTransfer.files[0]; + const text = e.dataTransfer.getData("Text"); + const reader = new FileReader(); + let inputCharcode = ""; + let offset = 0; + const CHUNK_SIZE = 20480; // 20KB const setInput = function() { if (inputCharcode.length > 100000 && this.app.autoBake_) { diff --git a/src/web/Manager.js b/src/web/Manager.js index efefc44d..ca334dcc 100755 --- a/src/web/Manager.js +++ b/src/web/Manager.js @@ -261,15 +261,16 @@ Manager.prototype.addDynamicListener = function(selector, eventType, callback, s * @param {Event} e - The event to be handled */ Manager.prototype.dynamicListenerHandler = function(e) { - let handlers = this.dynamicHandlers[e.type], - matches = e.target.matches || - e.target.webkitMatchesSelector || - e.target.mozMatchesSelector || - e.target.msMatchesSelector || - e.target.oMatchesSelector; + const { type, target } = e; + const handlers = this.dynamicHandlers[type]; + const matches = target.matches || + target.webkitMatchesSelector || + target.mozMatchesSelector || + target.msMatchesSelector || + target.oMatchesSelector; for (let i = 0; i < handlers.length; i++) { - if (matches && e.target[matches.name](handlers[i].selector)) { + if (matches && matches.call(target, handlers[i].selector)) { handlers[i].callback(e); } } diff --git a/src/web/OperationsWaiter.js b/src/web/OperationsWaiter.js index 7103ac38..992b737e 100755 --- a/src/web/OperationsWaiter.js +++ b/src/web/OperationsWaiter.js @@ -68,9 +68,9 @@ OperationsWaiter.prototype.searchOperations = function(e) { ops[selected-1].classList.add("selected-op"); } } else { - let searchResultsEl = document.getElementById("search-results"), - el = e.target, - str = el.value; + const searchResultsEl = document.getElementById("search-results"); + const el = e.target; + const str = el.value; while (searchResultsEl.firstChild) { try { @@ -81,12 +81,10 @@ OperationsWaiter.prototype.searchOperations = function(e) { $("#categories .in").collapse("hide"); if (str) { - let matchedOps = this.filterOperations(str, true), - matchedOpsHtml = ""; - - for (let i = 0; i < matchedOps.length; i++) { - matchedOpsHtml += matchedOps[i].toStubHtml(); - } + const matchedOps = this.filterOperations(str, true); + const matchedOpsHtml = matchedOps + .map(v => v.toStubHtml()) + .join(""); searchResultsEl.innerHTML = matchedOpsHtml; searchResultsEl.dispatchEvent(this.manager.oplistcreate); @@ -103,16 +101,16 @@ OperationsWaiter.prototype.searchOperations = function(e) { * name and description * @returns {string[]} */ -OperationsWaiter.prototype.filterOperations = function(searchStr, highlight) { - let matchedOps = [], - matchedDescs = []; +OperationsWaiter.prototype.filterOperations = function(inStr, highlight) { + const matchedOps = []; + const matchedDescs = []; - searchStr = searchStr.toLowerCase(); + const searchStr = inStr.toLowerCase(); for (const opName in this.app.operations) { - let op = this.app.operations[opName], - namePos = opName.toLowerCase().indexOf(searchStr), - descPos = op.description.toLowerCase().indexOf(searchStr); + const op = this.app.operations[opName]; + const namePos = opName.toLowerCase().indexOf(searchStr); + const descPos = op.description.toLowerCase().indexOf(searchStr); if (namePos >= 0 || descPos >= 0) { const operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager); @@ -236,12 +234,8 @@ OperationsWaiter.prototype.editFavouritesClick = function(e) { * Saves the selected favourites and reloads them. */ OperationsWaiter.prototype.saveFavouritesClick = function() { - let favouritesList = [], - favs = document.querySelectorAll("#edit-favourites-list li"); - - for (let i = 0; i < favs.length; i++) { - favouritesList.push(favs[i].textContent); - } + const favs = document.querySelectorAll("#edit-favourites-list li"); + const favouritesList = Array.from(favs, e => e.textContent); this.app.saveFavourites(favouritesList); this.app.loadFavourites(); @@ -281,8 +275,8 @@ OperationsWaiter.prototype.opIconMouseover = function(e) { * @param {event} e */ OperationsWaiter.prototype.opIconMouseleave = function(e) { - let opEl = e.target.parentNode, - toEl = e.toElement || e.relatedElement; + const opEl = e.target.parentNode; + const toEl = e.toElement || e.relatedElement; if (e.target.getAttribute("data-toggle") === "popover" && toEl === opEl) { $(opEl).popover("show"); diff --git a/src/web/OptionsWaiter.js b/src/web/OptionsWaiter.js index 6e92f4a0..ee3db0af 100755 --- a/src/web/OptionsWaiter.js +++ b/src/web/OptionsWaiter.js @@ -75,8 +75,8 @@ OptionsWaiter.prototype.resetOptionsClick = function() { * @param {boolean} state */ OptionsWaiter.prototype.switchChange = function(e, state) { - let el = e.target, - option = el.getAttribute("option"); + const el = e.target; + const option = el.getAttribute("option"); this.app.options[option] = state; localStorage.setItem("options", JSON.stringify(this.app.options)); @@ -90,8 +90,8 @@ OptionsWaiter.prototype.switchChange = function(e, state) { * @param {event} e */ OptionsWaiter.prototype.numberChange = function(e) { - let el = e.target, - option = el.getAttribute("option"); + const el = e.target; + const option = el.getAttribute("option"); this.app.options[option] = parseInt(el.value, 10); localStorage.setItem("options", JSON.stringify(this.app.options)); @@ -105,8 +105,8 @@ OptionsWaiter.prototype.numberChange = function(e) { * @param {event} e */ OptionsWaiter.prototype.selectChange = function(e) { - let el = e.target, - option = el.getAttribute("option"); + const el = e.target; + const option = el.getAttribute("option"); this.app.options[option] = el.value; localStorage.setItem("options", JSON.stringify(this.app.options)); diff --git a/src/web/OutputWaiter.js b/src/web/OutputWaiter.js index 7ff2cf0b..98292784 100755 --- a/src/web/OutputWaiter.js +++ b/src/web/OutputWaiter.js @@ -36,10 +36,10 @@ OutputWaiter.prototype.get = function() { * @param {number} duration - The length of time (ms) it took to generate the output */ OutputWaiter.prototype.set = function(dataStr, type, duration) { - let outputText = document.getElementById("output-text"), - outputHtml = document.getElementById("output-html"), - outputHighlighter = document.getElementById("output-highlighter"), - inputHighlighter = document.getElementById("input-highlighter"); + const outputText = document.getElementById("output-text"); + const outputHtml = document.getElementById("output-html"); + const outputHighlighter = document.getElementById("output-highlighter"); + const inputHighlighter = document.getElementById("input-highlighter"); if (type === "html") { outputText.style.display = "none"; @@ -103,11 +103,11 @@ OutputWaiter.prototype.setOutputInfo = function(length, lines, duration) { * without wrapping or overflowing. */ OutputWaiter.prototype.adjustWidth = function() { - let output = document.getElementById("output"), - saveToFile = document.getElementById("save-to-file"), - switchIO = document.getElementById("switch"), - undoSwitch = document.getElementById("undo-switch"), - maximiseOutput = document.getElementById("maximise-output"); + const output = document.getElementById("output"); + const saveToFile = document.getElementById("save-to-file"); + const switchIO = document.getElementById("switch"); + const undoSwitch = document.getElementById("undo-switch"); + const maximiseOutput = document.getElementById("maximise-output"); if (output.clientWidth < 680) { saveToFile.childNodes[1].nodeValue = ""; @@ -129,8 +129,8 @@ OutputWaiter.prototype.adjustWidth = function() { * Saves the current output to a file, downloaded as a URL octet stream. */ OutputWaiter.prototype.saveClick = function() { - let data = Utils.toBase64(this.app.dishStr), - filename = window.prompt("Please enter a filename:", "download.dat"); + const data = Utils.toBase64(this.app.dishStr); + const filename = window.prompt("Please enter a filename:", "download.dat"); if (filename) { const el = document.createElement("a"); diff --git a/src/web/RecipeWaiter.js b/src/web/RecipeWaiter.js index 57d7b272..b9cf23c5 100755 --- a/src/web/RecipeWaiter.js +++ b/src/web/RecipeWaiter.js @@ -60,8 +60,8 @@ RecipeWaiter.prototype.initialiseOperationDragNDrop = function() { }.bind(this)); Sortable.utils.on(recList, "touchend", function(e) { - let loc = e.changedTouches[0], - target = document.elementFromPoint(loc.clientX, loc.clientY); + const loc = e.changedTouches[0]; + const target = document.elementFromPoint(loc.clientX, loc.clientY); this.removeIntent = !recList.contains(target); }.bind(this)); @@ -276,8 +276,9 @@ RecipeWaiter.prototype.operationChildDblclick = function(e) { * @returns {recipeConfig} */ RecipeWaiter.prototype.getConfig = function() { - let config = [], ingredients, ingList, disabled, bp, item, - operations = document.querySelectorAll("#rec-list li.operation"); + const config = []; + let ingredients, ingList, disabled, bp, item; + const operations = document.querySelectorAll("#rec-list li.operation"); for (let i = 0; i < operations.length; i++) { ingredients = []; @@ -402,8 +403,8 @@ RecipeWaiter.prototype.clearRecipe = function() { * @param {event} e */ RecipeWaiter.prototype.dropdownToggleClick = function(e) { - let el = e.target, - button = el.parentNode.parentNode.previousSibling; + const el = e.target; + const button = el.parentNode.parentNode.previousSibling; button.innerHTML = el.textContent + " "; this.ingChange(); diff --git a/test/index.js b/test/index.js index d5037a78..c3bd49e6 100644 --- a/test/index.js +++ b/test/index.js @@ -19,10 +19,10 @@ import "./tests/operations/FlowControl.js"; import "./tests/operations/MorseCode.js"; import "./tests/operations/StrUtils.js"; -let allTestsPassing = true, - testStatusCounts = { - total: 0, - }; +let allTestsPassing = true; +const testStatusCounts = { + total: 0, +}; /**