keys.js 600 B

123456789101112131415161718
  1. require('../../modules/web.dom-collections.iterator');
  2. var classof = require('../../internals/classof');
  3. var hasOwn = require('../../internals/has-own-property');
  4. var isPrototypeOf = require('../../internals/object-is-prototype-of');
  5. var method = require('../array/virtual/keys');
  6. var ArrayPrototype = Array.prototype;
  7. var DOMIterables = {
  8. DOMTokenList: true,
  9. NodeList: true
  10. };
  11. module.exports = function (it) {
  12. var own = it.keys;
  13. return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.keys)
  14. || hasOwn(DOMIterables, classof(it)) ? method : own;
  15. };