|
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
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var CreateDataPropertyOrThrow = require('es-abstract/2024/CreateDataPropertyOrThrow');
|
|---|
| 4 | var OrdinaryObjectCreate = require('es-abstract/2024/OrdinaryObjectCreate');
|
|---|
| 5 |
|
|---|
| 6 | var forEach = require('es-abstract/helpers/forEach');
|
|---|
| 7 |
|
|---|
| 8 | var GroupBy = require('es-abstract/2024/GroupBy'); // TODO: replace with es-abstract 2024 implementation
|
|---|
| 9 |
|
|---|
| 10 | module.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.