diff --git a/source/Ox/js/Object.js b/source/Ox/js/Object.js index 82407e73..510ad593 100644 --- a/source/Ox/js/Object.js +++ b/source/Ox/js/Object.js @@ -4,9 +4,15 @@ Ox.extend Extends an object with one or more other objects > Ox.extend({a: 1, b: 1, c: 1}, {b: 2, c: 2}, {c: 3}) {a: 1, b: 2, c: 3} + > Ox.extend({a: 1}, 'b', 2) + {a: 1, b: 2} @*/ Ox.extend = function(object) { - Ox.forEach(Ox.slice(arguments, 1), function(argument, i) { + var args = Ox.slice(arguments, 1); + if (args.length == 2 && !Ox.isObject(args[0])) { + args = [Ox.makeObject(args)]; + } + Ox.forEach(args, function(argument, i) { Ox.forEach(argument, function(value, key) { object[key] = value; });