mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 17:08:31 +01:00
auto-fix prefer-const
This commit is contained in:
parent
5b03a84be8
commit
15aea9e9ea
5 changed files with 14 additions and 14 deletions
|
@ -426,7 +426,7 @@ const Code = {
|
|||
* @returns {string}
|
||||
*/
|
||||
_replaceVariableNames(input, replacer) {
|
||||
let tokenRegex = /\\"|"(?:\\"|[^"])*"|(\b[a-z0-9\-_]+\b)/ig;
|
||||
const tokenRegex = /\\"|"(?:\\"|[^"])*"|(\b[a-z0-9\-_]+\b)/ig;
|
||||
|
||||
return input.replace(tokenRegex, (...args) => {
|
||||
let match = args[0],
|
||||
|
@ -450,7 +450,7 @@ const Code = {
|
|||
*
|
||||
*/
|
||||
runToSnakeCase(input, args) {
|
||||
let smart = args[0];
|
||||
const smart = args[0];
|
||||
|
||||
if (smart) {
|
||||
return Code._replaceVariableNames(input, snakeCase);
|
||||
|
@ -469,7 +469,7 @@ const Code = {
|
|||
*
|
||||
*/
|
||||
runToCamelCase(input, args) {
|
||||
let smart = args[0];
|
||||
const smart = args[0];
|
||||
|
||||
if (smart) {
|
||||
return Code._replaceVariableNames(input, camelCase);
|
||||
|
@ -488,7 +488,7 @@ const Code = {
|
|||
*
|
||||
*/
|
||||
runToKebabCase(input, args) {
|
||||
let smart = args[0];
|
||||
const smart = args[0];
|
||||
|
||||
if (smart) {
|
||||
return Code._replaceVariableNames(input, kebabCase);
|
||||
|
|
|
@ -471,7 +471,7 @@ const StrUtils = {
|
|||
number = args[1];
|
||||
|
||||
delimiter = Utils.charRep[delimiter];
|
||||
let splitInput = input.split(delimiter);
|
||||
const splitInput = input.split(delimiter);
|
||||
|
||||
return splitInput
|
||||
.filter((line, lineIndex) => {
|
||||
|
@ -499,7 +499,7 @@ const StrUtils = {
|
|||
number = args[1];
|
||||
|
||||
delimiter = Utils.charRep[delimiter];
|
||||
let splitInput = input.split(delimiter);
|
||||
const splitInput = input.split(delimiter);
|
||||
|
||||
return splitInput
|
||||
.filter((line, lineIndex) => {
|
||||
|
|
|
@ -244,8 +244,8 @@ ControlsWaiter.prototype.loadClick = function() {
|
|||
* Saves the recipe specified in the save textarea to local storage.
|
||||
*/
|
||||
ControlsWaiter.prototype.saveButtonClick = function() {
|
||||
let recipeName = Utils.escapeHtml(document.getElementById("save-name").value);
|
||||
let recipeStr = document.getElementById("save-text").value;
|
||||
const recipeName = Utils.escapeHtml(document.getElementById("save-name").value);
|
||||
const recipeStr = document.getElementById("save-text").value;
|
||||
|
||||
if (!recipeName) {
|
||||
this.app.alert("Please enter a recipe name", "danger", 2000);
|
||||
|
|
|
@ -38,7 +38,7 @@ import Chef from "../src/core/Chef.js";
|
|||
TestRegister.prototype.runTests = function() {
|
||||
return Promise.all(
|
||||
this.tests.map(function(test, i) {
|
||||
let chef = new Chef();
|
||||
const chef = new Chef();
|
||||
|
||||
return Promise.resolve(chef.bake(
|
||||
test.input,
|
||||
|
@ -48,7 +48,7 @@ import Chef from "../src/core/Chef.js";
|
|||
false
|
||||
))
|
||||
.then(function(result) {
|
||||
let ret = {
|
||||
const ret = {
|
||||
test: test,
|
||||
status: null,
|
||||
output: null,
|
||||
|
|
|
@ -32,7 +32,7 @@ let allTestsPassing = true,
|
|||
* @returns {string}
|
||||
*/
|
||||
function statusToIcon(status) {
|
||||
let icons = {
|
||||
const icons = {
|
||||
erroring: "🔥",
|
||||
failing: "❌",
|
||||
passing: "✔️️",
|
||||
|
@ -48,7 +48,7 @@ function statusToIcon(status) {
|
|||
*/
|
||||
function handleTestResult(testResult) {
|
||||
allTestsPassing = allTestsPassing && testResult.status === "passing";
|
||||
let newCount = (testStatusCounts[testResult.status] || 0) + 1;
|
||||
const newCount = (testStatusCounts[testResult.status] || 0) + 1;
|
||||
testStatusCounts[testResult.status] = newCount;
|
||||
testStatusCounts.total += 1;
|
||||
|
||||
|
@ -83,8 +83,8 @@ TestRegister.runTests()
|
|||
|
||||
console.log("\n");
|
||||
|
||||
for (let testStatus in testStatusCounts) {
|
||||
let count = testStatusCounts[testStatus];
|
||||
for (const testStatus in testStatusCounts) {
|
||||
const count = testStatusCounts[testStatus];
|
||||
if (count > 0) {
|
||||
console.log(testStatus.toUpperCase(), count);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue