diff --git a/lib/client/config.js b/lib/client/config.js index 3608fb8e..9f19efaa 100644 --- a/lib/client/config.js +++ b/lib/client/config.js @@ -170,15 +170,33 @@ var CloudCmd, Util, DOM, io; }; function changeConfig(config) { - Object.keys(config).forEach(function(name) { - var item = config[name], - isBool = Util.type.boolean(item); + var array = Object.keys(config); + + mapCondition(array, function(name) { + var type = typeof config[name], + is = type === 'boolean'; - if (isBool) - config[name] = setState(item); + return is; + }).forEach(function(name) { + var item = config[name]; + + config[name] = setState(item); }); } + function mapCondition(array, fn) { + var result = []; + + array.forEach(function(item) { + var is = fn(item); + + if (is) + result.push(item); + }); + + return result; + } + function setState(state) { var ret = '';