Refactoring of Options. Renamed to OptionsHelper

Because that is what it is.
This commit is contained in:
logsol 2016-10-10 23:10:43 +02:00
parent ce01c8888e
commit 05c4e4de81
6 changed files with 23 additions and 23 deletions

View file

@ -6,18 +6,18 @@ function (Exception) {
"use strict";
function Options() {
function OptionsHelper() {
}
Options.prototype.merge = function(options, preset) {
OptionsHelper.prototype.merge = function(options, preset) {
if(!preset && !options) {
throw new Exception("Options requires objects");
throw new Exception("OptionsHelper requires objects");
}
if(preset.constructor !== Object && options.constructor !== Object) {
throw new Exception("Options requires objects");
throw new Exception("OptionsHelper requires objects");
}
if(!preset || preset.constructor !== Object) {
@ -43,7 +43,7 @@ function (Exception) {
if(options[key].constructor !== Object) {
preset[key] = options[key];
} else {
preset[key] = Options.prototype.merge.call(this, options[key], preset[key]);
preset[key] = OptionsHelper.prototype.merge.call(this, options[key], preset[key]);
}
}
}
@ -51,6 +51,6 @@ function (Exception) {
return preset;
}
return new Options();
return new OptionsHelper();
});