keys.js 521 B

12345678910111213141516
  1. require('../../modules/web.dom-collections.iterator');
  2. var keys = require('../array/virtual/keys');
  3. var classof = require('../../internals/classof');
  4. var ArrayPrototype = Array.prototype;
  5. var DOMIterables = {
  6. DOMTokenList: true,
  7. NodeList: true
  8. };
  9. module.exports = function (it) {
  10. var own = it.keys;
  11. return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.keys)
  12. // eslint-disable-next-line no-prototype-builtins -- safe
  13. || DOMIterables.hasOwnProperty(classof(it)) ? keys : own;
  14. };