UNPKG

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