add config.setDefaultValue

This commit is contained in:
nightwing 2013-01-29 22:37:14 +04:00
commit 38ca543035

View file

@ -258,4 +258,17 @@ exports.resetOptions = function(obj) {
});
};
exports.setDefaultValue = function(path, name, value) {
var opts = defaultOptions[path] || (defaultOptions[path] = {});
if (typeof name == "string") {
if (opts[name])
opts[name].value = value;
} else {
Object.keys(name).forEach(function(key) {
if (opts[key])
opts[key].value = name[key];
});
}
};
});