17 lines
529 B
JavaScript
17 lines
529 B
JavaScript
|
require('../../modules/web.dom-collections.iterator');
|
||
|
var forEach = require('../array/virtual/for-each');
|
||
|
var classof = require('../../internals/classof');
|
||
|
var ArrayPrototype = Array.prototype;
|
||
|
|
||
|
var DOMIterables = {
|
||
|
DOMTokenList: true,
|
||
|
NodeList: true
|
||
|
};
|
||
|
|
||
|
module.exports = function (it) {
|
||
|
var own = it.forEach;
|
||
|
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.forEach)
|
||
|
// eslint-disable-next-line no-prototype-builtins
|
||
|
|| DOMIterables.hasOwnProperty(classof(it)) ? forEach : own;
|
||
|
};
|