The proposal “Pipe operator (|>
) for JavaScript” (by J. S. Choi, James DiGioia, Ron Buckton and Tab Atkins) introduces a new operator. This operator is an idea borrowed from functional programming that makes applying functions more convenient in many cases.
This blog post describes how the pipe operator works and what its use cases are (there are more than you might expect!).
Dean Tribble (via Rob Palmer) has come up with a neat trick to create constants whose values are strings with their names. With a minor change, we can use it to set up symbol-valued constants.
.group()
and .groupToMap()
This blog post describes the ECMAScript proposal “Array grouping” by Justin Ridgewell.
structuredClone()
: deeply copying objects in JavaScriptSpreading is a common technique for copying objects in JavaScript:
Spreading has one significant downside – it creates shallow copies: The top levels are copied, but property values are shared.
structuredClone()
is a new function that will soon be supported by most browsers, Node.js and Deno. It creates deep copies of objects. This blog post explains how it works.
The ecosystem around delivering ECMAScript modules via packages is slowly maturing. This blog post explains how the various pieces fit together:
node:
protocol importsNode.js now supports a node:
protocol for built-in modules.
The ECMAScript proposal “Class static initialization blocks” by Ron Buckton is at stage 4 and scheduled to be included in ECMAScript 2022.
For setting up an instance of a class, we have two constructs in JavaScript:
For setting up the static part of a class, we only have static fields. The ECMAScript proposal introduces static initialization blocks for classes, which, roughly, are to static classes what constructors are to instances.
Iteration is a standard that connects operations with data containers: Each operation that follows this standard, can be applied to each data container that implements this standard.
In this blog post:
.map()
, .filter()
, and .forEach()
.A monorepo is a single repository that is used to manage multiple projects. In this blog post, we’ll explore how to set up a simple monorepo for two npm packages. All we need is already built into npm and TypeScript.
In this blog post, I’ll explain everything you need to know in order to use and produce native ECMAScript modules on Node.js.
The GitHub repository iterable
is an example of a TypeScript ESM package that works on Node.js. It still uses the "typesVersions"
workaround (which isn’t needed in TypeScript 4.7 and later).