entries.js 536 B

12345678910111213141516
  1. require('../../modules/web.dom-collections.iterator');
  2. var entries = require('../array/virtual/entries');
  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.entries;
  11. return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.entries)
  12. // eslint-disable-next-line no-prototype-builtins -- safe
  13. || DOMIterables.hasOwnProperty(classof(it)) ? entries : own;
  14. };