add Ox.hasOwn
This commit is contained in:
parent
eab834a643
commit
bb6f6d6471
1 changed files with 5 additions and 2 deletions
|
@ -5,8 +5,7 @@ Ox.extend <function> 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 <f> Equivalent of [].indexOf for objects
|
||||
> Ox.keyOf({a: 1, b: 2, c: 3}, 1)
|
||||
|
|
Loading…
Reference in a new issue