_object-to-array.js 468 B

12345678910111213141516
  1. var getKeys = require('./_object-keys');
  2. var toIObject = require('./_to-iobject');
  3. var isEnum = require('./_object-pie').f;
  4. module.exports = function (isEntries) {
  5. return function (it) {
  6. var O = toIObject(it);
  7. var keys = getKeys(O);
  8. var length = keys.length;
  9. var i = 0;
  10. var result = [];
  11. var key;
  12. while (length > i) if (isEnum.call(O, key = keys[i++])) {
  13. result.push(isEntries ? [key, O[key]] : O[key]);
  14. } return result;
  15. };
  16. };