values.js 531 B

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