_object-keys-internal.js 537 B

1234567891011121314151617
  1. var has = require('./_has');
  2. var toIObject = require('./_to-iobject');
  3. var arrayIndexOf = require('./_array-includes')(false);
  4. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  5. module.exports = function (object, names) {
  6. var O = toIObject(object);
  7. var i = 0;
  8. var result = [];
  9. var key;
  10. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  11. // Don't enum bug & hidden keys
  12. while (names.length > i) if (has(O, key = names[i++])) {
  13. ~arrayIndexOf(result, key) || result.push(key);
  14. }
  15. return result;
  16. };