allKeys.js 438 B

12345678910111213141516
  1. var isObject = require('./isObject.js');
  2. var _setup = require('./_setup.js');
  3. var _collectNonEnumProps = require('./_collectNonEnumProps.js');
  4. // Retrieve all the enumerable property names of an object.
  5. 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 (_setup.hasEnumBug) _collectNonEnumProps(obj, keys);
  11. return keys;
  12. }
  13. module.exports = allKeys;