(obj: any, ignoreNull?: boolean)
| 33 | * @return {Array<String>} property names |
| 34 | */ |
| 35 | export function getOwnEnumerables(obj: any, ignoreNull?: boolean): Array<string> { |
| 36 | if (!obj || typeof obj !== 'object' || Array.isArray(obj)) { |
| 37 | return []; |
| 38 | } |
| 39 | return Object.keys(obj).filter(function(key) { |
| 40 | if (ignoreNull) { |
| 41 | const value = obj[key]; |
| 42 | if (value === null || value === undefined || Number.isNaN(value)) { |
| 43 | return false; |
| 44 | } |
| 45 | } |
| 46 | return has(obj, key); |
| 47 | }); |
| 48 | } |
| 49 | |
| 50 | // faster way like `Object.create(null)` to get a 'clean' empty object |
| 51 | // https://github.com/nodejs/node/blob/master/lib/events.js#L5 |
nothing calls this directly
no test coverage detected
searching dependent graphs…