From bb6f6d647184fd77c68304a6dc95f7e59399878a Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 19 May 2012 13:39:25 +0400 Subject: [PATCH] add Ox.hasOwn --- source/Ox/js/Object.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/Ox/js/Object.js b/source/Ox/js/Object.js index c3072b0f..efcb042c 100644 --- a/source/Ox/js/Object.js +++ b/source/Ox/js/Object.js @@ -5,8 +5,7 @@ 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 = function() { - var obj = arguments[0]; +Ox.extend = function(obj) { Ox.forEach(Array.prototype.slice.call(arguments, 1), function(arg, i) { Ox.forEach(arg, function(val, key) { obj[key] = val; @@ -15,6 +14,10 @@ Ox.extend = function() { return obj; }; +Ox.hasOwn = function(obj, val) { + return Object.prototype.hasOwnProperty.call(obj, val) +}; + /*@ Ox.keyOf Equivalent of [].indexOf for objects > Ox.keyOf({a: 1, b: 2, c: 3}, 1)