2019-12

Synching into cloud directories (Dropbox etc.) to ignore node_modules

[2019-12-17] dev, nodejs

In this blog post, I describe how you can ignore node_modules by bidirectionally syncing into a cloud directory (as managed via Dropbox etc.).

2019-11

Techniques for instantiating classes

[2019-11-11] dev, javascript, oop

In this blog post, we examine several approaches for creating instances of classes: Constructors, factory functions, etc. We do so by solving one concrete problem several times. The focus of this post is on classes, which is why alternatives to classes are ignored.

Easier Node.js streams via async iteration

[2019-11-07] dev, javascript, nodejs, async

Working with Node.js streams is much more pleasant if we use asynchronous iteration. This blog post explores how to do that.

Attributes of object properties in JavaScript

[2019-11-03] dev, javascript, oop

In this blog post, we take a closer look at how the ECMAScript specification sees JavaScript objects. In particular, properties are not atomic in the spec, but composed of multiple attributes (think fields in a record). Even the value of a data property is stored in an attribute!

2019-10

Type coercion in JavaScript

[2019-10-31] dev, javascript, es spec

In this blog post, we examine the role of type coercion in JavaScript. We will go relatively deeply into this subject and, e.g., look into how the ECMAScript specification handles coercion.

Regular expressions in JavaScript: lookaround assertions by example

[2019-10-27] dev, javascript, regexp

These are lookaround assertions in regular expressions in JavaScript:

  • Positive lookahead: (?=«pattern»)
  • Negative lookahead: (?!«pattern»)
  • Positive lookbehind: (?<=«pattern»)
  • Negative lookbehind: (?<!«pattern»)

This blog post shows examples of using them.

Hybrid npm packages (ESM and CommonJS)

[2019-10-22] dev, javascript, jsmodules, nodejs, esm, commonjs

In this blog post, we look at npm packages that contain both ES modules and CommonJS modules.

The problems of shared mutable state and how to avoid them

[2019-10-21] dev, javascript, deepjs

This blog post answers the following questions:

  • What is shared mutable state?
  • Why is it problematic?
  • How can its problems be avoided?

Compiling TypeScript via webpack and babel-loader

[2019-10-12] dev, typescript, webpack, babel

ts-loader has one downside: We can’t pipe the output of another loader into it; it always reads the original file. As a work-around, we can use babel-loader to compile TypeScript. This blog post explains how.

Letting web app users run multi-module JavaScript code

[2019-10-11] dev, javascript

In a web app of mine, I wanted to let end users run multi-module JavaScript that they enter via text fields. It turns out that this simple idea is relatively difficult to implement. In this blog post, I’ll explain how to do it. It is less polished than usual – I mainly wanted to get the knowledge out there.