From a6a26864dfb2d621f6f516dac8441a79ab5e4ddd Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 13 Feb 2013 12:03:31 +0400 Subject: [PATCH] add setDefaultValues instead of doing two things in setDefaultValue --- lib/ace/config.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/ace/config.js b/lib/ace/config.js index 05d5f015..e3bd8da2 100644 --- a/lib/ace/config.js +++ b/lib/ace/config.js @@ -260,15 +260,18 @@ exports.resetOptions = function(obj) { exports.setDefaultValue = function(path, name, value) { var opts = defaultOptions[path] || (defaultOptions[path] = {}); - if (typeof name == "string") { - if (opts[name]) + if (opts[name]) { + if (opts.forwardTo) + exports.setDefaultValue(opts.forwardTo, name, value) + else opts[name].value = value; - } else { - Object.keys(name).forEach(function(key) { - if (opts[key]) - opts[key].value = name[key]; - }); } }; +exports.setDefaultValues = function(path, optionHash) { + Object.keys(optionHash).forEach(function(key) { + exports.setDefaultValue(path, key, optionHash[key]); + }); +}; + });