2016-05-22

Six nifty ES6 tricks

In this blog post, I show six tricks enabled by new ES6 features. At the end of each section, I point to related material in my book “Exploring ES6” (which is free to read online).

2016-05-15

Handling whitespace in ES6 template literals

In this blog post, we look at problems that arise when template literals contain whitespace:

  • Breaking up long lines
  • Dedenting content
  • Joining Arrays
  • Indenting inserted content

2016-04-17

Trees of Promises in ES6

This blog post shows how to handle trees of ES6 Promises, via an example where the contents of a directory are listed asynchronously.

2016-04-12

Tracking unhandled rejected Promises

In Promise-based asynchronous code, rejections are used for error handling. One risk is that rejections may get lost, leading to silent failures. For example:

    function main() {
        asyncFunc()
        .then(···)
        .then(() => console.log('Done!'));
    }

If asyncFunc() rejects the Promise it returns then that rejection will never be handled anywhere.

Let’s look at how you can track unhandled rejections in browsers and in Node.js.

2016-03-25

Promise-based functions should not throw exceptions

This blog post gives tips for error handling in asynchronous, Promise-based functions.

2016-03-20

The need for multi-platform npm packages

In this blog post, I argue that it should be possible to have multiple implementations of the same npm package (same name, same version).

2016-02-24

Arrow functions vs. bind()

ES6 arrow functions are often a compelling alternative to Function.prototype.bind().