refactor(cloudcmd) forEach -> for-of

This commit is contained in:
coderaiser 2019-05-20 18:54:26 +03:00
parent f7e47d2167
commit ee59fbf8d2
4 changed files with 22 additions and 30 deletions

View file

@ -16,7 +16,6 @@ module.exports = {
'C - Create User Menu File': async ({DOM, CloudCmd, tryToCatch}) => {
const {
Dialog,
RESTful,
CurrentInfo,
} = DOM;

View file

@ -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;
}