2017-07

ES2018: s (dotAll) flag for regular expressions

[2017-07-20] dev, javascript, esnext, es2018, regexp

The proposal “s (dotAll) flag for regular expressions” by Mathias Bynens is at stage 4. This blog post explains how it works.

ES2018: RegExp Unicode property escapes

[2017-07-19] dev, javascript, esnext, es2018, regexp

The proposal “RegExp Unicode Property Escapes” by Mathias Bynens is at stage 4. This blog post explains how it works.

2017-06

Delivering untranspiled source code via npm

[2017-06-01] dev, javascript, esnext, npm, jsmodules, babel, webpack

The idea of babel-preset-env is brilliant: write JavaScript with stage 4 features (or earlier stages, if you want to take that risk) and transpile it so that it is an exact fit for your target platform(s).

However, at the moment, preset-env only works for your own app, but not for your dependencies, which are normally already transpiled.

This blog post shows how package authors and package users can use the package.json property esnext to work with untranspiled source code in npm packages. The code is available in the repository esnext-demo on GitHub.

2017-05

Node.js 8: util.promisify()

[2017-05-30] dev, javascript, nodejs, esnext, async, promises

Node.js 8 has a new utility function: util.promisify(). It converts a callback-based function to a Promise-based one.

ES2018: RegExp lookbehind assertions

[2017-05-16] dev, javascript, esnext, es2018, regexp

The proposal “RegExp Lookbehind Assertions” by Gorkem Yakin, Nozomu Katō, Daniel Ehrenberg is part of ES2018. This blog post explains it.

ES2018: RegExp named capture groups

[2017-05-15] dev, javascript, esnext, es2018, regexp

The proposal “RegExp Named Capture Groups” by Gorkem Yakin, Daniel Ehrenberg is at stage 4. This blog post explains what it has to offer.

Module specifiers: what’s new with ES modules?

[2017-05-08] dev, javascript, esnext, jsmodules

This blog post describes how module specifiers (the path-like IDs of modules) change with ECMAScript modules (ESM). There are a few subtle differences, compared to the familiar CommonJS module (CJS) style.

2017-04

ES2019: Functional pattern – flatMap

[2017-04-30] dev, javascript, es2019

In this blog post, we look at the operation flatMap, which is similar to the Array method map(), but more versatile.

Conditionally adding entries inside Array and object literals

[2017-04-28] dev, javascript, esnext, pattern

This blog post shows how you can conditionally add elements inside Array literals and properties inside object literals.

Transpiling dependencies with Babel

[2017-04-23] dev, javascript, esnext, npm, jsmodules, babel

Figuring out the best strategy for transpiling with Babel is tricky. This blog post proposes a new strategy, made possible by Babel’s preset-env.