source: frontend/node_modules/object.groupby/implementation.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 671 bytes
RevLine 
[9af201e]1'use strict';
2
3var CreateDataPropertyOrThrow = require('es-abstract/2024/CreateDataPropertyOrThrow');
4var OrdinaryObjectCreate = require('es-abstract/2024/OrdinaryObjectCreate');
5
6var forEach = require('es-abstract/helpers/forEach');
7
8var GroupBy = require('es-abstract/2024/GroupBy'); // TODO: replace with es-abstract 2024 implementation
9
10module.exports = function groupBy(items, callbackfn) {
11 var groups = GroupBy(items, callbackfn, 'PROPERTY'); // step 1
12
13 var obj = OrdinaryObjectCreate(null); // step 2
14
15 forEach(groups, function (g) { // step 3
16 CreateDataPropertyOrThrow(obj, g['[[Key]]'], g['[[Elements]]']); // steps 3.a - 3.b
17 });
18
19 return obj; // step 4
20};
Note: See TracBrowser for help on using the repository browser.