get-own-non-enumerable-keys-x
v4.1.2
Published
Like Reflect.ownKeys but gets only non-enumerable properties.
Downloads
23
Maintainers
Readme
get-own-non-enumerable-keys-x
Like Reflect.ownKeys but gets only non-enumerable properties.
wn-non-enumerable-keys-x--module.exports">
module.exports(target)
⇒ Array ⏏
This method returns only the non-enumerable own keys of an object. Note: It is not possible the get a list of non-enumerable own keys in older environments and therefore an empty array will be returned.
Kind: Exported function
Returns: Array - The non-enumerable own keys.
Throws:
- typeError - If target is null or undefined.
| Param | Type | Description | | ------ | ------------------- | ----------- | | target | Object | The target. |
Example
import getOwnNonEnumerableKeys from 'get-own-non-enumerable-keys-x';
const obj = {bar: 1, foo: 2};
Object.defineProperty(obj, '1', {
value: 'first',
});
const symbol = Symbol('first');
Object.defineProperty(obj, symbol, {
value: 'second',
});
getOwnNonEnumerableKeys(obj); // ['1', symbol]