diff --git a/JSTests/stress/array-group-by-null-or-undefined.js b/JSTests/stress/array-group-by-null-or-undefined.js index db4cb2137ebd..2f7cbd20a9aa 100644 --- a/JSTests/stress/array-group-by-null-or-undefined.js +++ b/JSTests/stress/array-group-by-null-or-undefined.js @@ -1,4 +1,4 @@ -//@ requireOptions("--useArrayGroupByMethod=1") +//@ requireOptions("--useArrayGroupMethod=1") function shouldThrow(func, errorMessage) { var errorThrown = false; @@ -16,15 +16,15 @@ function shouldThrow(func, errorMessage) { } shouldThrow(() => { - Array.prototype.groupBy.call(null, () => { /* empty */ }) -}, `TypeError: Array.prototype.groupBy requires that |this| not be null or undefined`); + Array.prototype.group.call(null, () => { /* empty */ }) +}, `TypeError: Array.prototype.group requires that |this| not be null or undefined`); shouldThrow(() => { - Array.prototype.groupBy.call(undefined, () => { /* empty */ }) -}, `TypeError: Array.prototype.groupBy requires that |this| not be null or undefined`); + Array.prototype.group.call(undefined, () => { /* empty */ }) +}, `TypeError: Array.prototype.group requires that |this| not be null or undefined`); shouldThrow(() => { - Array.prototype.groupByToMap.call(null, () => { /* empty */ }) -}, `TypeError: Array.prototype.groupByToMap requires that |this| not be null or undefined`); + Array.prototype.groupToMap.call(null, () => { /* empty */ }) +}, `TypeError: Array.prototype.groupToMap requires that |this| not be null or undefined`); shouldThrow(() => { - Array.prototype.groupByToMap.call(undefined, () => { /* empty */ }) -}, `TypeError: Array.prototype.groupByToMap requires that |this| not be null or undefined`); + Array.prototype.groupToMap.call(undefined, () => { /* empty */ }) +}, `TypeError: Array.prototype.groupToMap requires that |this| not be null or undefined`); diff --git a/JSTests/stress/array-groupBy.js b/JSTests/stress/array-groupBy.js index 367dff368a05..08aafd10c83b 100644 --- a/JSTests/stress/array-groupBy.js +++ b/JSTests/stress/array-groupBy.js @@ -1,4 +1,4 @@ -//@ requireOptions("--useArrayGroupByMethod=1") +//@ requireOptions("--useArrayGroupMethod=1") function shouldBe(actual, expected) { if (actual !== expected) @@ -39,7 +39,7 @@ function toObject(array) { result.length = array.length; for (let i in array) result[i] = array[i]; - result.groupBy = Array.prototype.groupBy; + result.group = Array.prototype.group; return result; } @@ -51,7 +51,7 @@ function reverseInsertionOrder(array) { let result = {}; for (let i = props.length - 1; i >= 0; i--) result[props[i]] = obj[props[i]]; - result.groupBy = Array.prototype.groupBy; + result.group = Array.prototype.group; return result; } @@ -66,97 +66,97 @@ let objectWithValueOfThatThrows = { // Basic -shouldBe(Array.prototype.groupBy.length, 1); -shouldBe(Array.prototype.groupBy.name, "groupBy"); +shouldBe(Array.prototype.group.length, 1); +shouldBe(Array.prototype.group.name, "group"); -shouldBeObject([undefined].groupBy((x) => x === undefined ? "a" : "b"), {"a": [undefined]}); -shouldBeObject([undefined].groupBy((x) => x === undefined), {"true": [undefined]}); +shouldBeObject([undefined].group((x) => x === undefined ? "a" : "b"), {"a": [undefined]}); +shouldBeObject([undefined].group((x) => x === undefined), {"true": [undefined]}); -shouldBeObject((new Array(4)).groupBy((x) => x === undefined ? "a" : "b"), {"a": [undefined, undefined, undefined, undefined]}); -shouldBeObject((new Array(4)).groupBy((x) => x === undefined), {"true": [undefined, undefined, undefined, undefined]}); +shouldBeObject((new Array(4)).group((x) => x === undefined ? "a" : "b"), {"a": [undefined, undefined, undefined, undefined]}); +shouldBeObject((new Array(4)).group((x) => x === undefined), {"true": [undefined, undefined, undefined, undefined]}); -shouldBeObject([0, 1, 2, 3].groupBy((x) => !(x & 1) ? "a" : "b"), {"a": [0, 2], "b": [1, 3]}); -shouldBeObject([0, 1, 2, 3].groupBy((x) => !(x & 1)), {"true": [0, 2], "false": [1, 3]}); +shouldBeObject([0, 1, 2, 3].group((x) => !(x & 1) ? "a" : "b"), {"a": [0, 2], "b": [1, 3]}); +shouldBeObject([0, 1, 2, 3].group((x) => !(x & 1)), {"true": [0, 2], "false": [1, 3]}); -shouldBeObject([0, 1, 2, 3].groupBy((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, 3]}); -shouldBeObject([0, 1, 2, 3].groupBy((x, i) => i >= 2), {"false": [0, 1], "true": [2, 3]}); +shouldBeObject([0, 1, 2, 3].group((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, 3]}); +shouldBeObject([0, 1, 2, 3].group((x, i) => i >= 2), {"false": [0, 1], "true": [2, 3]}); -shouldBeObject(mixPartialAndFast.groupBy((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, undefined, undefined, sparseArrayLength - 1]}); -shouldBeObject(mixPartialAndFast.groupBy((x, i) => i >= 2), {"false": [0, 1], "true": [2, undefined, undefined, sparseArrayLength - 1]}); +shouldBeObject(mixPartialAndFast.group((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, undefined, undefined, sparseArrayLength - 1]}); +shouldBeObject(mixPartialAndFast.group((x, i) => i >= 2), {"false": [0, 1], "true": [2, undefined, undefined, sparseArrayLength - 1]}); // Generic Object -shouldBeObject(toObject([undefined]).groupBy((x) => x === undefined ? "a" : "b"), {"a": [undefined]}); -shouldBeObject(toObject([undefined]).groupBy((x) => x === undefined), {"true": [undefined]}); +shouldBeObject(toObject([undefined]).group((x) => x === undefined ? "a" : "b"), {"a": [undefined]}); +shouldBeObject(toObject([undefined]).group((x) => x === undefined), {"true": [undefined]}); -shouldBeObject(toObject(new Array(4)).groupBy((x) => x === undefined ? "a" : "b"), {"a": [undefined, undefined, undefined, undefined]}); -shouldBeObject(toObject(new Array(4)).groupBy((x) => x === undefined), {"true": [undefined, undefined, undefined, undefined]}); +shouldBeObject(toObject(new Array(4)).group((x) => x === undefined ? "a" : "b"), {"a": [undefined, undefined, undefined, undefined]}); +shouldBeObject(toObject(new Array(4)).group((x) => x === undefined), {"true": [undefined, undefined, undefined, undefined]}); -shouldBeObject(toObject([0, 1, 2, 3]).groupBy((x) => !(x & 1) ? "a" : "b"), {"a": [0, 2], "b": [1, 3]}); -shouldBeObject(toObject([0, 1, 2, 3]).groupBy((x) => !(x & 1)), {"true": [0, 2], "false": [1, 3]}); +shouldBeObject(toObject([0, 1, 2, 3]).group((x) => !(x & 1) ? "a" : "b"), {"a": [0, 2], "b": [1, 3]}); +shouldBeObject(toObject([0, 1, 2, 3]).group((x) => !(x & 1)), {"true": [0, 2], "false": [1, 3]}); -shouldBeObject(toObject([0, 1, 2, 3]).groupBy((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, 3]}); -shouldBeObject(toObject([0, 1, 2, 3]).groupBy((x, i) => i >= 2), {"false": [0, 1], "true": [2, 3]}); +shouldBeObject(toObject([0, 1, 2, 3]).group((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, 3]}); +shouldBeObject(toObject([0, 1, 2, 3]).group((x, i) => i >= 2), {"false": [0, 1], "true": [2, 3]}); -shouldBeObject(toObject(mixPartialAndFast).groupBy((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, undefined, undefined, sparseArrayLength - 1]}); -shouldBeObject(toObject(mixPartialAndFast).groupBy((x, i) => i >= 2), {"false": [0, 1], "true": [2, undefined, undefined, sparseArrayLength - 1]}); +shouldBeObject(toObject(mixPartialAndFast).group((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, undefined, undefined, sparseArrayLength - 1]}); +shouldBeObject(toObject(mixPartialAndFast).group((x, i) => i >= 2), {"false": [0, 1], "true": [2, undefined, undefined, sparseArrayLength - 1]}); // Array-like object with invalid lengths -shouldBeObject(Array.prototype.groupBy.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: 0 }, notReached), {}); -shouldBeObject(Array.prototype.groupBy.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -0 }, notReached), {}); -shouldBeObject(Array.prototype.groupBy.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -4 }, notReached), {}); +shouldBeObject(Array.prototype.group.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: 0 }, notReached), {}); +shouldBeObject(Array.prototype.group.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -0 }, notReached), {}); +shouldBeObject(Array.prototype.group.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -4 }, notReached), {}); // Reversed generic Object -shouldBeObject(reverseInsertionOrder([undefined]).groupBy((x) => x === undefined ? "a" : "b"), {"a": [undefined]}); -shouldBeObject(reverseInsertionOrder([undefined]).groupBy((x) => x === undefined), {"true": [undefined]}); +shouldBeObject(reverseInsertionOrder([undefined]).group((x) => x === undefined ? "a" : "b"), {"a": [undefined]}); +shouldBeObject(reverseInsertionOrder([undefined]).group((x) => x === undefined), {"true": [undefined]}); -shouldBeObject(reverseInsertionOrder(new Array(4)).groupBy((x) => x === undefined ? "a" : "b"), {"a": [undefined, undefined, undefined, undefined]}); -shouldBeObject(reverseInsertionOrder(new Array(4)).groupBy((x) => x === undefined), {"true": [undefined, undefined, undefined, undefined]}); +shouldBeObject(reverseInsertionOrder(new Array(4)).group((x) => x === undefined ? "a" : "b"), {"a": [undefined, undefined, undefined, undefined]}); +shouldBeObject(reverseInsertionOrder(new Array(4)).group((x) => x === undefined), {"true": [undefined, undefined, undefined, undefined]}); -shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).groupBy((x) => !(x & 1) ? "a" : "b"), {"a": [0, 2], "b": [1, 3]}); -shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).groupBy((x) => !(x & 1)), {"true": [0, 2], "false": [1, 3]}); +shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).group((x) => !(x & 1) ? "a" : "b"), {"a": [0, 2], "b": [1, 3]}); +shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).group((x) => !(x & 1)), {"true": [0, 2], "false": [1, 3]}); -shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).groupBy((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, 3]}); -shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).groupBy((x, i) => i >= 2), {"false": [0, 1], "true": [2, 3]}); +shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).group((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, 3]}); +shouldBeObject(reverseInsertionOrder([0, 1, 2, 3]).group((x, i) => i >= 2), {"false": [0, 1], "true": [2, 3]}); -shouldBeObject(reverseInsertionOrder(mixPartialAndFast).groupBy((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, undefined, undefined, sparseArrayLength - 1]}); -shouldBeObject(reverseInsertionOrder(mixPartialAndFast).groupBy((x, i) => i >= 2), {"false": [0, 1], "true": [2, undefined, undefined, sparseArrayLength - 1]}); +shouldBeObject(reverseInsertionOrder(mixPartialAndFast).group((x, i) => i >= 2 ? "a" : "b"), {"b": [0, 1], "a": [2, undefined, undefined, sparseArrayLength - 1]}); +shouldBeObject(reverseInsertionOrder(mixPartialAndFast).group((x, i) => i >= 2), {"false": [0, 1], "true": [2, undefined, undefined, sparseArrayLength - 1]}); // Extra callback parameters -shouldBeObject([0, 1, 2, 3].groupBy((i, j, k, l, m) => m = !m), {"true": [0, 1, 2, 3]}); +shouldBeObject([0, 1, 2, 3].group((i, j, k, l, m) => m = !m), {"true": [0, 1, 2, 3]}); // Special keys -shouldBeObject([0, 1, 2, 3].groupBy((x) => "constructor").constructor, [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => "constructor").constructor, [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupBy((x) => "prototype").prototype, [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupBy((x) => "__proto__").__proto__, [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => "prototype").prototype, [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => "__proto__").__proto__, [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupBy((x) => -0)[0], [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupBy((x) => 0)[0], [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => -0)[0], [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => 0)[0], [0, 1, 2, 3]); let objectWithToStringCounter = { counter: 0, toString() { return this.counter++; }, }; -shouldBeObject([0, 1, 2, 3].groupBy((x) => objectWithToStringCounter), {"0": [0], "1": [1], "2": [2], "3": [3]}); +shouldBeObject([0, 1, 2, 3].group((x) => objectWithToStringCounter), {"0": [0], "1": [1], "2": [2], "3": [3]}); shouldBe(objectWithToStringCounter.counter, 4); try { - shouldBeObject([0, 1, 2, 3].groupBy((x) => objectWithToStringThatThrows), {}); + shouldBeObject([0, 1, 2, 3].group((x) => objectWithToStringThatThrows), {}); notReached(); } catch (e) { shouldBe(e.message, "should not reach here"); } -shouldBeObject([0, 1, 2, 3].groupBy((x) => objectWithValueOfThatThrows)["[object Object]"], [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => objectWithValueOfThatThrows)["[object Object]"], [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupBy((x) => symbol)[symbol], [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].group((x) => symbol)[symbol], [0, 1, 2, 3]); diff --git a/JSTests/stress/array-groupByToMap.js b/JSTests/stress/array-groupByToMap.js index aa4eaee50cc6..bcda59d2b97b 100644 --- a/JSTests/stress/array-groupByToMap.js +++ b/JSTests/stress/array-groupByToMap.js @@ -1,4 +1,4 @@ -//@ requireOptions("--useArrayGroupByMethod=1") +//@ requireOptions("--useArrayGroupMethod=1") function shouldBe(actual, expected) { if (actual !== expected) @@ -43,7 +43,7 @@ function toObject(array) { result.length = array.length; for (let i in array) result[i] = array[i]; - result.groupByToMap = Array.prototype.groupByToMap; + result.groupToMap = Array.prototype.groupToMap; return result; } @@ -55,7 +55,7 @@ function reverseInsertionOrder(array) { let result = {}; for (let i = props.length - 1; i >= 0; i--) result[props[i]] = obj[props[i]]; - result.groupByToMap = Array.prototype.groupByToMap; + result.groupToMap = Array.prototype.groupToMap; return result; } @@ -70,92 +70,92 @@ let objectWithValueOfThatThrows = { // Basic -shouldBe(Array.prototype.groupByToMap.length, 1); -shouldBe(Array.prototype.groupByToMap.name, "groupByToMap"); +shouldBe(Array.prototype.groupToMap.length, 1); +shouldBe(Array.prototype.groupToMap.name, "groupToMap"); -shouldBeMap([undefined].groupByToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined]]]); -shouldBeMap([undefined].groupByToMap((x) => x === undefined), [[true, [undefined]]]); +shouldBeMap([undefined].groupToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined]]]); +shouldBeMap([undefined].groupToMap((x) => x === undefined), [[true, [undefined]]]); -shouldBeMap((new Array(4)).groupByToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined, undefined, undefined, undefined]]]); -shouldBeMap((new Array(4)).groupByToMap((x) => x === undefined), [[true, [undefined, undefined, undefined, undefined]]]); +shouldBeMap((new Array(4)).groupToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined, undefined, undefined, undefined]]]); +shouldBeMap((new Array(4)).groupToMap((x) => x === undefined), [[true, [undefined, undefined, undefined, undefined]]]); -shouldBeMap([0, 1, 2, 3].groupByToMap((x) => !(x & 1) ? "a" : "b"), [["a", [0, 2]], ["b", [1, 3]]]); -shouldBeMap([0, 1, 2, 3].groupByToMap((x) => !(x & 1)), [[true, [0, 2]], [false, [1, 3]]]); +shouldBeMap([0, 1, 2, 3].groupToMap((x) => !(x & 1) ? "a" : "b"), [["a", [0, 2]], ["b", [1, 3]]]); +shouldBeMap([0, 1, 2, 3].groupToMap((x) => !(x & 1)), [[true, [0, 2]], [false, [1, 3]]]); -shouldBeMap([0, 1, 2, 3].groupByToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, 3]]]); -shouldBeMap([0, 1, 2, 3].groupByToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, 3]]]); +shouldBeMap([0, 1, 2, 3].groupToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, 3]]]); +shouldBeMap([0, 1, 2, 3].groupToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, 3]]]); -shouldBeMap(mixPartialAndFast.groupByToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, undefined, undefined, sparseArrayLength - 1]]]); -shouldBeMap(mixPartialAndFast.groupByToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, undefined, undefined, sparseArrayLength - 1]]]); +shouldBeMap(mixPartialAndFast.groupToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, undefined, undefined, sparseArrayLength - 1]]]); +shouldBeMap(mixPartialAndFast.groupToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, undefined, undefined, sparseArrayLength - 1]]]); // Generic Object -shouldBeMap(toObject([undefined]).groupByToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined]]]); -shouldBeMap(toObject([undefined]).groupByToMap((x) => x === undefined), [[true, [undefined]]]); +shouldBeMap(toObject([undefined]).groupToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined]]]); +shouldBeMap(toObject([undefined]).groupToMap((x) => x === undefined), [[true, [undefined]]]); -shouldBeMap(toObject(new Array(4)).groupByToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined, undefined, undefined, undefined]]]); -shouldBeMap(toObject(new Array(4)).groupByToMap((x) => x === undefined), [[true, [undefined, undefined, undefined, undefined]]]); +shouldBeMap(toObject(new Array(4)).groupToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined, undefined, undefined, undefined]]]); +shouldBeMap(toObject(new Array(4)).groupToMap((x) => x === undefined), [[true, [undefined, undefined, undefined, undefined]]]); -shouldBeMap(toObject([0, 1, 2, 3]).groupByToMap((x) => !(x & 1) ? "a" : "b"), [["a", [0, 2]], ["b", [1, 3]]]); -shouldBeMap(toObject([0, 1, 2, 3]).groupByToMap((x) => !(x & 1)), [[true, [0, 2]], [false, [1, 3]]]); +shouldBeMap(toObject([0, 1, 2, 3]).groupToMap((x) => !(x & 1) ? "a" : "b"), [["a", [0, 2]], ["b", [1, 3]]]); +shouldBeMap(toObject([0, 1, 2, 3]).groupToMap((x) => !(x & 1)), [[true, [0, 2]], [false, [1, 3]]]); -shouldBeMap(toObject([0, 1, 2, 3]).groupByToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, 3]]]); -shouldBeMap(toObject([0, 1, 2, 3]).groupByToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, 3]]]); +shouldBeMap(toObject([0, 1, 2, 3]).groupToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, 3]]]); +shouldBeMap(toObject([0, 1, 2, 3]).groupToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, 3]]]); -shouldBeMap(toObject(mixPartialAndFast).groupByToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, undefined, undefined, sparseArrayLength - 1]]]); -shouldBeMap(toObject(mixPartialAndFast).groupByToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, undefined, undefined, sparseArrayLength - 1]]]); +shouldBeMap(toObject(mixPartialAndFast).groupToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, undefined, undefined, sparseArrayLength - 1]]]); +shouldBeMap(toObject(mixPartialAndFast).groupToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, undefined, undefined, sparseArrayLength - 1]]]); // Array-like object with invalid lengths -shouldBeMap(Array.prototype.groupByToMap.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: 0 }, notReached), []); -shouldBeMap(Array.prototype.groupByToMap.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -0 }, notReached), []); -shouldBeMap(Array.prototype.groupByToMap.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -4 }, notReached), []); +shouldBeMap(Array.prototype.groupToMap.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: 0 }, notReached), []); +shouldBeMap(Array.prototype.groupToMap.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -0 }, notReached), []); +shouldBeMap(Array.prototype.groupToMap.call({ 0: 0, 1: 1, 2: 2, 3: 3, length: -4 }, notReached), []); // Reversed generic Object -shouldBeMap(reverseInsertionOrder([undefined]).groupByToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined]]]); -shouldBeMap(reverseInsertionOrder([undefined]).groupByToMap((x) => x === undefined), [[true, [undefined]]]); +shouldBeMap(reverseInsertionOrder([undefined]).groupToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined]]]); +shouldBeMap(reverseInsertionOrder([undefined]).groupToMap((x) => x === undefined), [[true, [undefined]]]); -shouldBeMap(reverseInsertionOrder(new Array(4)).groupByToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined, undefined, undefined, undefined]]]); -shouldBeMap(reverseInsertionOrder(new Array(4)).groupByToMap((x) => x === undefined), [[true, [undefined, undefined, undefined, undefined]]]); +shouldBeMap(reverseInsertionOrder(new Array(4)).groupToMap((x) => x === undefined ? "a" : "b"), [["a", [undefined, undefined, undefined, undefined]]]); +shouldBeMap(reverseInsertionOrder(new Array(4)).groupToMap((x) => x === undefined), [[true, [undefined, undefined, undefined, undefined]]]); -shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupByToMap((x) => !(x & 1) ? "a" : "b"), [["a", [0, 2]], ["b", [1, 3]]]); -shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupByToMap((x) => !(x & 1)), [[true, [0, 2]], [false, [1, 3]]]); +shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupToMap((x) => !(x & 1) ? "a" : "b"), [["a", [0, 2]], ["b", [1, 3]]]); +shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupToMap((x) => !(x & 1)), [[true, [0, 2]], [false, [1, 3]]]); -shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupByToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, 3]]]); -shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupByToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, 3]]]); +shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, 3]]]); +shouldBeMap(reverseInsertionOrder([0, 1, 2, 3]).groupToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, 3]]]); -shouldBeMap(reverseInsertionOrder(mixPartialAndFast).groupByToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, undefined, undefined, sparseArrayLength - 1]]]); -shouldBeMap(reverseInsertionOrder(mixPartialAndFast).groupByToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, undefined, undefined, sparseArrayLength - 1]]]); +shouldBeMap(reverseInsertionOrder(mixPartialAndFast).groupToMap((x, i) => i >= 2 ? "a" : "b"), [["b", [0, 1]], ["a", [2, undefined, undefined, sparseArrayLength - 1]]]); +shouldBeMap(reverseInsertionOrder(mixPartialAndFast).groupToMap((x, i) => i >= 2), [[false, [0, 1]], [true, [2, undefined, undefined, sparseArrayLength - 1]]]); // Extra callback parameters -shouldBeMap([0, 1, 2, 3].groupByToMap((i, j, k, l, m) => m = !m), [[true, [0, 1, 2, 3]]]); +shouldBeMap([0, 1, 2, 3].groupToMap((i, j, k, l, m) => m = !m), [[true, [0, 1, 2, 3]]]); // Special keys -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => "constructor").get("constructor"), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => "constructor").get("constructor"), [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => "prototype").get("prototype"), [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => "__proto__").get("__proto__"), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => "prototype").get("prototype"), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => "__proto__").get("__proto__"), [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => -0).get(0), [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => 0).get(0), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => -0).get(0), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => 0).get(0), [0, 1, 2, 3]); let objectWithToStringCounter = { counter: 0, toString() { return this.counter++; }, }; -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => objectWithToStringCounter).get(objectWithToStringCounter), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => objectWithToStringCounter).get(objectWithToStringCounter), [0, 1, 2, 3]); shouldBe(objectWithToStringCounter.counter, 0); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => objectWithToStringThatThrows).get(objectWithToStringThatThrows), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => objectWithToStringThatThrows).get(objectWithToStringThatThrows), [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => objectWithValueOfThatThrows).get(objectWithValueOfThatThrows), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => objectWithValueOfThatThrows).get(objectWithValueOfThatThrows), [0, 1, 2, 3]); -shouldBeObject([0, 1, 2, 3].groupByToMap((x) => symbol).get(symbol), [0, 1, 2, 3]); +shouldBeObject([0, 1, 2, 3].groupToMap((x) => symbol).get(symbol), [0, 1, 2, 3]); diff --git a/JSTests/stress/unscopables.js b/JSTests/stress/unscopables.js index 6746b783ed52..12a3534860be 100644 --- a/JSTests/stress/unscopables.js +++ b/JSTests/stress/unscopables.js @@ -11,7 +11,7 @@ function test(actual, expected) { test(typeof unscopables, "object"); test(unscopables.__proto__, undefined); - test(String(Object.keys(unscopables).sort()), "at,copyWithin,entries,fill,find,findIndex,findLast,findLastIndex,flat,flatMap,includes,keys,toReversed,toSorted,toSpliced,values"); + test(String(Object.keys(unscopables).sort()), "at,copyWithin,entries,fill,find,findIndex,findLast,findLastIndex,flat,flatMap,group,groupToMap,includes,keys,toReversed,toSorted,toSpliced,values"); }()); (function () { diff --git a/JSTests/test262/config.yaml b/JSTests/test262/config.yaml index 51ac3d3e24cc..6d2d43bf5b4d 100644 --- a/JSTests/test262/config.yaml +++ b/JSTests/test262/config.yaml @@ -8,7 +8,7 @@ flags: String.prototype.at: useAtMethod Temporal: useTemporal array-find-from-last: useArrayFindLastMethod - array-grouping: useArrayGroupByMethod + array-grouping: useArrayGroupMethod Object.hasOwn: useHasOwn ShadowRealm: useShadowRealm skip: diff --git a/JSTests/test262/test/built-ins/Array/prototype/Symbol.unscopables/array-grouping.js b/JSTests/test262/test/built-ins/Array/prototype/Symbol.unscopables/array-grouping.js index 4e58eb711aaf..0631ccf37c04 100644 --- a/JSTests/test262/test/built-ins/Array/prototype/Symbol.unscopables/array-grouping.js +++ b/JSTests/test262/test/built-ins/Array/prototype/Symbol.unscopables/array-grouping.js @@ -8,8 +8,8 @@ info: | 22.1.3.32 Array.prototype [ @@unscopables ] ... - 10. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupBy", true). - 11. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupByToMap", true). + 10. Perform ! CreateDataPropertyOrThrow(unscopableList, "group", true). + 11. Perform ! CreateDataPropertyOrThrow(unscopableList, "groupToMap", true). ... includes: [propertyHelper.js] @@ -20,12 +20,12 @@ var unscopables = Array.prototype[Symbol.unscopables]; assert.sameValue(Object.getPrototypeOf(unscopables), null); -assert.sameValue(unscopables.groupBy, true, '`groupBy` property value'); -verifyEnumerable(unscopables, 'groupBy'); -verifyWritable(unscopables, 'groupBy'); -verifyConfigurable(unscopables, 'groupBy'); +assert.sameValue(unscopables.group, true, '`group` property value'); +verifyEnumerable(unscopables, 'group'); +verifyWritable(unscopables, 'group'); +verifyConfigurable(unscopables, 'group'); -assert.sameValue(unscopables.groupByToMap, true, '`groupByToMap` property value'); -verifyEnumerable(unscopables, 'groupByToMap'); -verifyWritable(unscopables, 'groupByToMap'); -verifyConfigurable(unscopables, 'groupByToMap'); +assert.sameValue(unscopables.groupToMap, true, '`groupToMap` property value'); +verifyEnumerable(unscopables, 'groupToMap'); +verifyWritable(unscopables, 'groupToMap'); +verifyConfigurable(unscopables, 'groupToMap'); diff --git a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt b/LayoutTests/inspector/model/remote-object-get-properties-expected.txt index a4af919d5d73..90bb74d71e23 100644 --- a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt +++ b/LayoutTests/inspector/model/remote-object-get-properties-expected.txt @@ -74,6 +74,8 @@ ALL PROPERTIES: indexOf lastIndexOf filter + group + groupToMap flat flatMap reduce @@ -134,6 +136,8 @@ OWN PROPERTIES: indexOf lastIndexOf filter + group + groupToMap flat flatMap reduce @@ -179,6 +183,8 @@ DISPLAYABLE PROPERTIES: indexOf lastIndexOf filter + group + groupToMap flat flatMap reduce @@ -224,6 +230,8 @@ ALL PROPERTIES: indexOf lastIndexOf filter + group + groupToMap flat flatMap reduce diff --git a/LayoutTests/js/Object-getOwnPropertyNames-expected.txt b/LayoutTests/js/Object-getOwnPropertyNames-expected.txt index a701c3b21e5f..3a0fdb84a368 100644 --- a/LayoutTests/js/Object-getOwnPropertyNames-expected.txt +++ b/LayoutTests/js/Object-getOwnPropertyNames-expected.txt @@ -47,7 +47,7 @@ PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defi PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype'] PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString'] PASS getSortedOwnPropertyNames(Array) is ['from', 'isArray', 'length', 'name', 'of', 'prototype'] -PASS getSortedOwnPropertyNames(Array.prototype) is ['at', 'concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toReversed', 'toSorted', 'toSpliced', 'toString', 'unshift', 'values', 'with'] +PASS getSortedOwnPropertyNames(Array.prototype) is ['at', 'concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'flat', 'flatMap', 'forEach', 'group', 'groupToMap', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toReversed', 'toSorted', 'toSpliced', 'toString', 'unshift', 'values', 'with'] PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw'] PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'at', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf'] PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype'] diff --git a/LayoutTests/js/array-unscopables-properties-expected.txt b/LayoutTests/js/array-unscopables-properties-expected.txt index e5c7733fcd39..ef782e0472bd 100644 --- a/LayoutTests/js/array-unscopables-properties-expected.txt +++ b/LayoutTests/js/array-unscopables-properties-expected.txt @@ -50,6 +50,14 @@ PASS Array.prototype[Symbol.unscopables]["flatMap"] is true PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flatMap").writable is true PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flatMap").enumerable is true PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "flatMap").configurable is true +PASS Array.prototype[Symbol.unscopables]["group"] is true +PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "group").writable is true +PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "group").enumerable is true +PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "group").configurable is true +PASS Array.prototype[Symbol.unscopables]["groupToMap"] is true +PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "groupToMap").writable is true +PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "groupToMap").enumerable is true +PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "groupToMap").configurable is true PASS Array.prototype[Symbol.unscopables]["includes"] is true PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").writable is true PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").enumerable is true diff --git a/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js b/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js index 40f138794035..0bdf6c226aca 100644 --- a/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js +++ b/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js @@ -56,7 +56,7 @@ var expectedPropertyNamesSet = { "Function": "['length', 'name', 'prototype']", "Function.prototype": "['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']", "Array": "['from', 'isArray', 'length', 'name', 'of', 'prototype']", - "Array.prototype": "['at', 'concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toReversed', 'toSorted', 'toSpliced', 'toString', 'unshift', 'values', 'with']", + "Array.prototype": "['at', 'concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'flat', 'flatMap', 'forEach', 'group', 'groupToMap', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toReversed', 'toSorted', 'toSpliced', 'toString', 'unshift', 'values', 'with']", "String": "['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']", "String.prototype": "['anchor', 'at', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']", "Boolean": "['length', 'name', 'prototype']", diff --git a/LayoutTests/js/script-tests/array-unscopables-properties.js b/LayoutTests/js/script-tests/array-unscopables-properties.js index 1d15dd13dcf5..08661e3eddfc 100644 --- a/LayoutTests/js/script-tests/array-unscopables-properties.js +++ b/LayoutTests/js/script-tests/array-unscopables-properties.js @@ -17,6 +17,8 @@ let expectedEntries = [ "findLastIndex", "flat", "flatMap", + "group", + "groupToMap", "includes", "keys", "toReversed", diff --git a/Source/JavaScriptCore/builtins/ArrayPrototype.js b/Source/JavaScriptCore/builtins/ArrayPrototype.js index c5dc2b13fb8a..2dc718253437 100644 --- a/Source/JavaScriptCore/builtins/ArrayPrototype.js +++ b/Source/JavaScriptCore/builtins/ArrayPrototype.js @@ -156,15 +156,15 @@ function filter(callback /*, thisArg */) return result; } -function groupBy(callback /*, thisArg */) +function group(callback /*, thisArg */) { "use strict"; - var array = @toObject(this, "Array.prototype.groupBy requires that |this| not be null or undefined"); + var array = @toObject(this, "Array.prototype.group requires that |this| not be null or undefined"); var length = @toLength(array.length); if (!@isCallable(callback)) - @throwTypeError("Array.prototype.groupBy callback must be a function"); + @throwTypeError("Array.prototype.group callback must be a function"); var thisArg = @argument(1); @@ -182,15 +182,15 @@ function groupBy(callback /*, thisArg */) return groups; } -function groupByToMap(callback /*, thisArg */) +function groupToMap(callback /*, thisArg */) { "use strict"; - var array = @toObject(this, "Array.prototype.groupByToMap requires that |this| not be null or undefined"); + var array = @toObject(this, "Array.prototype.groupToMap requires that |this| not be null or undefined"); var length = @toLength(array.length); if (!@isCallable(callback)) - @throwTypeError("Array.prototype.groupByToMap callback must be a function"); + @throwTypeError("Array.prototype.groupToMap callback must be a function"); var thisArg = @argument(1); diff --git a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp index d4eb686f6d05..e63e34386513 100644 --- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -100,9 +100,9 @@ void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) JSC_NATIVE_INTRINSIC_FUNCTION_WITHOUT_TRANSITION("indexOf"_s, arrayProtoFuncIndexOf, static_cast(PropertyAttribute::DontEnum), 1, ImplementationVisibility::Public, ArrayIndexOfIntrinsic); JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("lastIndexOf"_s, arrayProtoFuncLastIndexOf, static_cast(PropertyAttribute::DontEnum), 1, ImplementationVisibility::Public); JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().filterPublicName(), arrayPrototypeFilterCodeGenerator, static_cast(PropertyAttribute::DontEnum)); - if (Options::useArrayGroupByMethod()) { - JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().groupByPublicName(), arrayPrototypeGroupByCodeGenerator, static_cast(PropertyAttribute::DontEnum)); - JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().groupByToMapPublicName(), arrayPrototypeGroupByToMapCodeGenerator, static_cast(PropertyAttribute::DontEnum)); + if (Options::useArrayGroupMethod()) { + JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().groupPublicName(), arrayPrototypeGroupCodeGenerator, static_cast(PropertyAttribute::DontEnum)); + JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().groupToMapPublicName(), arrayPrototypeGroupToMapCodeGenerator, static_cast(PropertyAttribute::DontEnum)); } JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().flatPublicName(), arrayPrototypeFlatCodeGenerator, static_cast(PropertyAttribute::DontEnum)); JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().flatMapPublicName(), arrayPrototypeFlatMapCodeGenerator, static_cast(PropertyAttribute::DontEnum)); @@ -150,8 +150,8 @@ void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) Options::useArrayFindLastMethod() ? &vm.propertyNames->builtinNames().findLastIndexPublicName() : nullptr, &vm.propertyNames->builtinNames().flatPublicName(), &vm.propertyNames->builtinNames().flatMapPublicName(), - Options::useArrayGroupByMethod() ? &vm.propertyNames->builtinNames().groupByPublicName() : nullptr, - Options::useArrayGroupByMethod() ? &vm.propertyNames->builtinNames().groupByToMapPublicName() : nullptr, + Options::useArrayGroupMethod() ? &vm.propertyNames->builtinNames().groupPublicName() : nullptr, + Options::useArrayGroupMethod() ? &vm.propertyNames->builtinNames().groupToMapPublicName() : nullptr, &vm.propertyNames->builtinNames().includesPublicName(), &vm.propertyNames->builtinNames().keysPublicName(), Options::useChangeArrayByCopyMethods() ? &vm.propertyNames->builtinNames().toReversedPublicName() : nullptr, diff --git a/Source/JavaScriptCore/runtime/OptionsList.h b/Source/JavaScriptCore/runtime/OptionsList.h index 7663c5196431..6e4e14cad7b9 100644 --- a/Source/JavaScriptCore/runtime/OptionsList.h +++ b/Source/JavaScriptCore/runtime/OptionsList.h @@ -541,7 +541,7 @@ bool canUseWebAssemblyFastMemory(); /* Feature Flags */\ \ v(Bool, useArrayFindLastMethod, true, Normal, "Expose the findLast() and findLastIndex() methods on Array and %TypedArray%.") \ - v(Bool, useArrayGroupByMethod, false, Normal, "Expose the groupBy() and groupByToMap() methods on Array.") \ + v(Bool, useArrayGroupMethod, true, Normal, "Expose the group() and groupToMap() methods on Array.") \ v(Bool, useAtMethod, true, Normal, "Expose the at() method on Array, %TypedArray%, and String.") \ v(Bool, useChangeArrayByCopyMethods, true, Normal, "Expose the withAt(), withReversed(), withSorted() and withSpliced() methods on Array and %TypedArray%.") \ v(Bool, useHasOwn, true, Normal, "Expose the Object.hasOwn method") \ diff --git a/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js b/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js index f8a913c0f207..e583474e3003 100644 --- a/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js +++ b/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js @@ -252,8 +252,8 @@ WI.NativePrototypeFunctionParameters = { findLast: "callback, [thisArg]", findLastIndex: "callback, [thisArg]", forEach: "callback, [thisArg]", - groupBy: "callback, [thisArg]", - groupByToMap: "callback, [thisArg]", + group: "callback, [thisArg]", + groupToMap: "callback, [thisArg]", includes: "searchValue, [startIndex=0]", indexOf: "searchValue, [startIndex=0]", join: "[separator=\",\"]",