hasKey
Determine whether an object contains a key on itself or its prototype chain
hasKey(obj, key)
Return true if an object's properties include the property key key or an object on its prototype
chain's properties include the key key, false otherwise.
An object may implement @@can.hasKey to override default behavior.
By default, canReflect.hasKey will use hasOwnKey and return true if the key is present.
If hasOwnKey returns false, the in Operator will be used.
var foo = new DefineMap({ "bar": "baz" });
canReflect.in(foo, "bar"); // -> true
canReflect.in(foo, "each"); // -> true
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 or an object on its prototype chain's key set contains key, false otherwise