hasOwnKey
Determine whether an object contains a key on itself, not only on its prototype chain
hasOwnKey(obj, key)
Return true if an object's own properties include the property key key, false otherwise.
An object may implement @@can.hasOwnKey to override default behavior.
By default, canReflect.hasOwnKey will first look for
[can-symbol/symbols/getOwnKey @@can.getOwnKey] on obj. If present, it will call @@can.getOwnKey and
test key against the returned Array of keys. If absent, Object.prototype.hasOwnKey() is used.
var foo = new DefineMap({ "bar": "baz" });
canReflect.hasOwnKey(foo, "bar"); // -> true
canReflect.hasOwnKey(foo, "each"); // -> false
foo.each // -> function each() {...}
Parameters
- obj
{Object}:Any MapLike object
- key
{String}:The key to look up on
obj
Returns
{Boolean}:
true if obj's key set contains key, false otherwise