allKeys.js 416 B

12345678910111213
  1. import isObject from './isObject.js';
  2. import { hasEnumBug } from './_setup.js';
  3. import collectNonEnumProps from './_collectNonEnumProps.js';
  4. // Retrieve all the enumerable property names of an object.
  5. export default function allKeys(obj) {
  6. if (!isObject(obj)) return [];
  7. var keys = [];
  8. for (var key in obj) keys.push(key);
  9. // Ahem, IE < 9.
  10. if (hasEnumBug) collectNonEnumProps(obj, keys);
  11. return keys;
  12. }