entries.js 623 B

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