diff --git a/client/input.js b/client/input.js index e475e77f..7eea66b8 100644 --- a/client/input.js +++ b/client/input.js @@ -29,16 +29,14 @@ module.exports.convert = (config) => { const result = { ...config, }; + const array = Object.keys(config); - const array = Object.keys(result); + const filtered = array.filter(isBool(config)); - array - .filter(isBool(result)) - .forEach((name) => { - const item = result[name]; - - result[name] = setState(item); - }); + for (const name of filtered) { + const item = config[name]; + result[name] = setState(item); + } return result; }; diff --git a/client/listeners/index.js b/client/listeners/index.js index 54d9d0c2..d2170b5d 100644 --- a/client/listeners/index.js +++ b/client/listeners/index.js @@ -44,9 +44,8 @@ const unselect = (event) => { }; const execAll = currify((funcs, event) => { - funcs.forEach((fn) => { + for (const fn of funcs) fn(event); - }); }); const Info = DOM.CurrentInfo; @@ -260,7 +259,7 @@ function toggleSelect(key, files) { return DOM.toggleSelectedFile(file); if (key.shift) - return files.forEach(DOM.selectFile); + return files.map(DOM.selectFile); } function changePanel(element) { @@ -404,16 +403,12 @@ function contextMenu() { function dragndrop() { const panels = DOM.getByClassAll('panel'); - const select = () => { - [...panels].forEach((panel) => { - panel.classList.add('selected-panel'); - }); + const select = ({target}) => { + target.classList.add('selected-panel'); }; - const unselect = () => { - [...panels].forEach((panel) => { - panel.classList.remove('selected-panel'); - }); + const unselect = ({target}) => { + target.classList.remove('selected-panel'); }; const onDrop = (event) => { @@ -458,13 +453,12 @@ function dragndrop() { event.preventDefault(); }; - Events.add('dragenter', select); - Events.add(['dragleave', 'drop'], unselect); - - [...panels].forEach((panel) => { - Events.add('dragover', panel, onDragOver) - .add('drop', panel, onDrop); - }); + for (const panel of panels) + Events + .add('dragover', panel, onDragOver) + .add('drop', panel, onDrop) + .add('dragenter', select) + .add(['dragleave', 'drop'], unselect); } function unload() { diff --git a/client/modules/user-menu/default-menu.js b/client/modules/user-menu/default-menu.js index d2b40097..ceaf37d2 100644 --- a/client/modules/user-menu/default-menu.js +++ b/client/modules/user-menu/default-menu.js @@ -16,7 +16,6 @@ module.exports = { 'C - Create User Menu File': async ({DOM, CloudCmd, tryToCatch}) => { const { - Dialog, RESTful, CurrentInfo, } = DOM; diff --git a/client/modules/view.js b/client/modules/view.js index 8c52a830..e2db1116 100644 --- a/client/modules/view.js +++ b/client/modules/view.js @@ -168,21 +168,22 @@ function initConfig(Config, options) { if (!options) return config; - Object.keys(options).forEach((name) => { + const names = Object.keys(options); + for (const name of names) { const isConfig = !!config[name]; const item = options[name]; const isFunc = itype.function(item); if (!isFunc || !isConfig) { config[name] = options[name]; - return; + continue; } const func = config[name]; config[name] = () => { exec.series([func, item]); }; - }); + } return config; }