array-for-each.js 564 B

123456789101112
  1. 'use strict';
  2. var $forEach = require('../internals/array-iteration').forEach;
  3. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  4. var STRICT_METHOD = arrayMethodIsStrict('forEach');
  5. // `Array.prototype.forEach` method implementation
  6. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  7. module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
  8. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  9. // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
  10. } : [].forEach;