Ox.InfoList: make value method accept (id, {key: value})

This commit is contained in:
rolux 2013-12-01 14:55:57 +01:00
parent 9d189c55da
commit 3a28b08d46

View file

@ -266,15 +266,19 @@ Ox.InfoList = function(options, self) {
(id) -> values (id) -> values
(id, key) -> value (id, key) -> value
(id, key, value) -> <o> (id, key, value) -> <o>
(id, {key: value}) -> <o>
@*/ @*/
that.value = function(id, key, value) { that.value = function() {
// fixme: make this accept id, {k: v, ...} var args = Ox.slice(arguments),
id = args.shift();
if (arguments.length == 1) { if (arguments.length == 1) {
return that.$element.value(id); return that.$element.value(id);
} else if (arguments.length == 2) { } else if (arguments.length == 2 && Ox.isString(arguments[1])) {
return that.$element.value(id, key); return that.$element.value(id, key);
} else { } else {
Ox.forEach(Ox.makeObject(args), function(value, key) {
that.$element.value(id, key, value); that.$element.value(id, key, value);
});
return that; return that;
} }
}; };