diff --git a/client/client.js b/client/client.js index f151c803..5d7ac82f 100644 --- a/client/client.js +++ b/client/client.js @@ -259,9 +259,9 @@ function CloudCmdProto(DOM) { if (!modules) return; - modules.local.forEach((module) => { + for (const module of modules.local) { load(null, module, doBefore[module]); - }); + } }); function baseInit(callback) { diff --git a/client/dom/buffer.js b/client/dom/buffer.js index a844384f..6d7f05e8 100644 --- a/client/dom/buffer.js +++ b/client/dom/buffer.js @@ -36,17 +36,17 @@ function BufferProto() { function addCutClass() { const files = DOM.getActiveFiles(); - files.forEach((element) => { + for (const element of files) { element.classList.add(CLASS); - }); + } } function rmCutClass() { const files = DOM.getByClassAll(CLASS); - [...files].forEach((element) => { + for (const element of [...files]) { element.classList.remove(CLASS); - }); + } } function callIfEnabled(callback) { diff --git a/client/dom/events/index.js b/client/dom/events/index.js index 692360d8..4bfd290a 100644 --- a/client/dom/events/index.js +++ b/client/dom/events/index.js @@ -60,23 +60,24 @@ function EventsProto() { break; case 'array': - eventName.forEach((eventName) => { + for (const eventName of eventName) { parseArgs(eventName, element, listener, callback); - }); + } + break; case 'object': - Object.keys(eventName).forEach((name) => { + for (const name of Object.keys(eventName)) { const eventListener = eventName[name]; parseArgs(name, element, eventListener, callback); - }); + } break; } diff --git a/client/dom/load.js b/client/dom/load.js index 56bfe759..513de732 100644 --- a/client/dom/load.js +++ b/client/dom/load.js @@ -48,10 +48,10 @@ module.exports.ajax = (params) => { xhr.open(type, p.url, true); - Object.keys(headers).forEach((name) => { + for (const name of Object.keys(headers)) { const value = headers[name]; xhr.setRequestHeader(name, value); - }); + } if (p.responseType) xhr.responseType = p.responseType; diff --git a/client/modules/config/index.js b/client/modules/config/index.js index d85d2942..5db8ee06 100644 --- a/client/modules/config/index.js +++ b/client/modules/config/index.js @@ -206,12 +206,12 @@ async function onChange(el) { } function onSave(obj) { - Object.keys(obj).forEach((name) => { + for (const name of Object.keys(obj)) { const data = obj[name]; CloudCmd._config(name, data); input.setValue(name, data, Element); - }); + } } async function saveHttp(obj) { diff --git a/client/modules/menu.js b/client/modules/menu.js index 502d4100..5616400c 100644 --- a/client/modules/menu.js +++ b/client/modules/menu.js @@ -267,7 +267,7 @@ function download(type) { if (!files.length) return alertNoFiles(); - files.forEach((file) => { + for (const file of files) { const selected = DOM.isSelected(file); const isDir = DOM.isCurrentIsDir(file); const path = DOM.getCurrentPath(file); @@ -302,7 +302,7 @@ function download(type) { if (selected) DOM.toggleSelectedFile(file); - }); + } } function getCurrentPosition() { diff --git a/common/entity.js b/common/entity.js index c3c718c4..bad8ef77 100644 --- a/common/entity.js +++ b/common/entity.js @@ -10,23 +10,23 @@ const Entities = { const keys = Object.keys(Entities); module.exports.encode = (str) => { - keys.forEach((code) => { + for (const code of keys) { const char = Entities[code]; const reg = RegExp(char, 'g'); str = str.replace(reg, code); - }); + } return str; }; module.exports.decode = (str) => { - keys.forEach((code) => { + for (const code of keys) { const char = Entities[code]; const reg = RegExp(code, 'g'); str = str.replace(reg, char); - }); + } return str; }; diff --git a/server/cloudcmd.js b/server/cloudcmd.js index e878ea15..03fa26eb 100644 --- a/server/cloudcmd.js +++ b/server/cloudcmd.js @@ -62,7 +62,7 @@ module.exports = (params) => { checkPlugins(plugins); - keys.forEach((name) => { + for (const name of keys) { let value = options[name]; if (/root/.test(name)) @@ -75,7 +75,7 @@ module.exports = (params) => { value = prefixer(value); config(name, value); - }); + } config('console', defaultValue(config, 'console', options)); config('configDialog', defaultValue(config, 'configDialog', options)); diff --git a/server/config.js b/server/config.js index 4927f2fe..bba94351 100644 --- a/server/config.js +++ b/server/config.js @@ -229,9 +229,9 @@ async function patchConfig(manage, {name, request, response, cache}) { } function traverse([manage, json]) { - Object.keys(json).forEach((name) => { + for (const name of Object.keys(json)) { manage(name, json[name]); - }); + } } module.exports._cryptoPass = cryptoPass;