Is your feature request related to a problem? Please describe.
Start using features from this JS version
Describe the solution you'd like
Start using useful features from this JS version.
The 15th edition, ECMAScript 2024, was published in June 2024. This version introduces the Object.groupBy and Map.groupBy static methods, Promise.withResolvers, various set operations on Set.prototype, and the /v unicode flag for regular expressions.
.
The Object.groupBy and Map.groupBy methods group an iterable collection using the return value of a provided callback function.
.
// sample data
const arr = [
{ year: "2024", id: 0 },
{ year: "2023", id: 1 },
{ year: "2024", id: 2 },
];
.
const obj = Object.groupBy(arr, (el) => el.year);
console.log(obj);
// { "2024": [{ year: "2024", id: 0 }, { year: "2024", id: 2 }], "2023": [{ year: "2023", id: 1 }] }
.
Promise.withResolvers provides a simple way to get a promise's resolve and reject functions directly without having to assign them in the constructor.
.
// ES 2023
let resolve;
let reject;
let promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
.
// ES 2024
const { resolve, reject, promise } = Promise.withResolvers();
.
The /v flag in regular expressions is simply an improved version of the /u flag, but as it makes backwards-incompatible changes it had to be introduced as a new flag
Additional context
Update:
- docs/README.md (ecmaVersion)
- eslint.config.js
- any JS code
Is your feature request related to a problem? Please describe.
Start using features from this JS version
Describe the solution you'd like
Start using useful features from this JS version.
Additional context
Update: