Edd Mann Developer

Promisifying Error-First Asynchronous Callbacks in JavaScript

I have been writing a lot about Promises in JavaScript the past couple of weeks. What happens however, when you wish to use an asynchronous function which does not return a Promise, such as those found in Node? It is actually pretty simple to abstract away the error-first asynchronous function callback into a Promise we can handle.

Using Generators for Promise Coroutines in JavaScript

In a previous article I demonstrated how a new feature from ES2016 (async/await functions) could be used to help coordinate promises and execution. However, we are instead able to use Generators (introduced in ES2015) to provide this feature, minus the syntactic sugar these two new keywords provide.

Arrow Functions Lexical 'this' Scoping in JavaScript

One feature of ES2015 that I feel can be a stumbling block (but extremely useful) is Arrow Functions lexical scoping of this. Before this addition, every new function defined its own this - meaning we were required to explicitly bind or locally store the this reference that we desired in many use-cases.

Mimicking Named Parameters in JavaScript

Whilst working today I came across a test helper function that required a few too many parameters. Debating weather to break the function up, I decided that an elegant solution would be to take advantage of ES2015 object deconstruction and produce a form of ‘Named Parameters’.