es.array.reduce-right.js 901 B

12345678910111213141516171819
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var $reduceRight = require('../internals/array-reduce').right;
  4. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  5. var CHROME_VERSION = require('../internals/environment-v8-version');
  6. var IS_NODE = require('../internals/environment-is-node');
  7. // Chrome 80-82 has a critical bug
  8. // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
  9. var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
  10. var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduceRight');
  11. // `Array.prototype.reduceRight` method
  12. // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  13. $({ target: 'Array', proto: true, forced: FORCED }, {
  14. reduceRight: function reduceRight(callbackfn /* , initialValue */) {
  15. return $reduceRight(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
  16. }
  17. });