mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 19:31:09 +00:00

PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
13 lines
367 B
JavaScript
13 lines
367 B
JavaScript
'use strict';
|
|
|
|
var forOf = require('es6-iterator/for-of')
|
|
, isIterable = require('es6-iterator/is-iterable')
|
|
, iterable = require('./validate')
|
|
|
|
, forEach = Array.prototype.forEach;
|
|
|
|
module.exports = function (target, cb/*, thisArg*/) {
|
|
if (isIterable(iterable(target))) forOf(target, cb, arguments[2]);
|
|
else forEach.call(target, cb, arguments[2]);
|
|
};
|