esnext.array.group-by.js 678 B

1234567891011121314151617
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var $groupBy = require('../internals/array-group-by');
  4. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  5. var addToUnscopables = require('../internals/add-to-unscopables');
  6. // `Array.prototype.groupBy` method
  7. // https://github.com/tc39/proposal-array-grouping
  8. // https://bugs.webkit.org/show_bug.cgi?id=236541
  9. $({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupBy') }, {
  10. groupBy: function groupBy(callbackfn /* , thisArg */) {
  11. var thisArg = arguments.length > 1 ? arguments[1] : undefined;
  12. return $groupBy(this, callbackfn, thisArg);
  13. }
  14. });
  15. addToUnscopables('groupBy');