getOwnEnumerableKeys
Return the list of keys which can be iterated over on an object
getOwnEnumerableKeys(obj)
Return all keys on obj
which have been defined as enumerable, either from explicitly setting
enumerable
on the property descriptor, or by using =
to set the value of the property without
a key descriptor, but excluding properties that only exist on obj
's prototype chain. The
default behavior can be overridden by implementing
@@can.getOwnEnumerableKeys on obj
. By default,
canReflect.getOwnEnumerableKeys
will use @@can.getOwnKeys to
retrieve the set of keys and @@can.getOwnKeyDescriptor
to filter for those which are enumerable. If either symbol is absent from obj
, Object.keys
is used.
var foo = new DefineMap({ bar: "baz", [canSymbol.for("quux")]: "thud" });
Object.defineProperty(foo, "jeek", {
enumerable: true,
value: "plonk"
});
canReflect.getOwnEnumerableKeys(foo); // -> ["bar", "jeek"]
Parameters
- obj
{Object}
:Any Map-like object
Returns
{Array}
:
the Array of all enumerable keys from the object, either using
@@can.getOwnEnumerableKeys
from obj
, or filtering
obj
's own keys for those which are enumerable.