Debian Codegraph @

js/src/tests/test262/built-ins/Map/groupBy/map-instance.js

raw
1 // Copyright (c) 2023 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-map.groupby
6 description: Map.groupBy returns a Map instance
7 info: |
8 Map.groupBy ( items, callbackfn )
9
10 ...
11
12 2. Let map be ! Construct(%Map%).
13 ...
14 4. Return map.
15
16 ...
17 features: [array-grouping, Map]
18 ---*/
19
20 const array = [1, 2, 3];
21
22 const map = Map.groupBy(array, function (i) {
23 return i % 2 === 0 ? 'even' : 'odd';
24 });
25
26 assert.sameValue(map instanceof Map, true);
27
28 reportCompare(0, 0);