1234567891011121314151617181920 |
- 'use strict';
- var CreateDataPropertyOrThrow = require('es-abstract/2023/CreateDataPropertyOrThrow');
- var OrdinaryObjectCreate = require('es-abstract/2023/OrdinaryObjectCreate');
- var forEach = require('es-abstract/helpers/forEach');
- var GroupBy = require('./aos/GroupBy');
- module.exports = function groupBy(items, callbackfn) {
- var groups = GroupBy(items, callbackfn, 'property');
- var obj = OrdinaryObjectCreate(null);
- forEach(groups, function (g) {
- CreateDataPropertyOrThrow(obj, g['[[Key]]'], g['[[Elements]]']);
- });
- return obj;
- };
|