There were several items on the agenda, this post focuses on feature proposals and their progress from the 105th TC39 meeting [2th-5th December 2024].
Stage 4
- Intl.DurationFormat Provides a way to format a duration (e.g., "1 hour, 30 minutes") in a locale-sensitive manner.
new Intl.DurationFormat("fr-FR", { style: "long" }).format({
hours: 1,
minutes: 46,
seconds: 40,
});
// => "1 heure, 46 minutes et 40 secondes"
Stage 3
-
Error.isError
Adds a static
isError
method to check whether a given value is an instance of theError
object.
Error.isError(undefined); // false
Error.isError(isError(new Error()); // true
Stage 2.7
- ESM Phase Imports Enhances the ECMAScript Module (ESM) system with new import capabilities to streamline inter-module dependency declarations.
import source myModule from "./my-module.js";
// `{ type: 'module' }` can be inferred since myModule is a module object
const worker = new Worker(myModule);
P.S: Note this is a conditional approval.
Stage 2
-
Immutable ArrayBuffer
Introduces the concept of immutable
ArrayBuffer
to prevent mutation of binary data after creation.
Object.freeze(new Uint8Array(buf.transferToImmutable()));
- Intl Currency Display Choices Expands options for displaying currency values, such as adding control over currency symbols and code styles.
const formal = new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
currencyDisplay: "formalSymbol",
});
formal.format(42); // "US$42.00"
const never = new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD",
currencyDisplay: "never",
});
never.format(42); // "42.00"
Stage 1
- Import Sync An explicit synchronous import function for ES modules, building on the synchronous execution behavior defined by the Defer Import Eval proposal.
let react;
try {
react = import.sync('react');
} catch {}
if (react) {
// Bind to the React framework, if available
}
- Stabilize New integrity "level" protecting against both override mistakes and proxy reentrancy
Hemanth HM
Top comments (0)