blob: 74f2f2d18c2997e88e5c283fd7f167f1985f5029 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright (c) 2023 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.groupby
description: Callback is not called and object is not populated if the iterable is empty
info: |
Object.groupBy ( items, callbackfn )
...
GroupBy ( items, callbackfn, coercion )
6. Repeat,
c. If next is false, then
i. Return groups.
...
features: [array-grouping]
---*/
const original = [];
const obj = Object.groupBy(original, function () {
throw new Test262Error('callback function should not be called')
});
assert.notSameValue(original, obj, 'Object.groupBy returns an object');
assert.sameValue(Object.keys(obj).length, 0);
reportCompare(0, 0);
|