debian-mirror-gitlab/core-js/stable/instance/for-each.js
2019-09-25 13:30:05 +05:30

16 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;
};