Skip to content

Instantly share code, notes, and snippets.

Axel Rauschmayer rauschma

Block or report user

Report or block rauschma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

What will future hybrid npm packages look like?

Status quo

It’s great to see how many npm packages already come with ESM versions. Most common seems to be:

"main": "src/main.js",
"module": "dist/mypkg.esm.js",
View copy-constructor.js
class Point {
constructor(...args) {
switch (args.length) {
case 2: {
// Normal constructor
const [x, y] = args;
this.x = x;
this.y = y;
View md-tag-function.ts
* A quick way of using Markdown inside JSX: via tagged templates
* Downsides:
* – Works completely dynamically (no static compilation)
* – Big downside: You must escape backticks.
* Potential work-around in template tag function: result.replace(/∆/ug, '`')
* Upsides:
* – Preserves line breaks (JSX doesn’t)



    at f (eval at <anonymous> (first-steps-bundle.js:33), <anonymous>:5:11)
    at g (eval at <anonymous> (first-steps-bundle.js:33), <anonymous>:8:5)
    at eval (eval at <anonymous> (first-steps-bundle.js:33), <anonymous>:10:3)
    at eval (eval at <anonymous> (first-steps-bundle.js:33), <anonymous>:16:2)

Update of “JavaScript for impatient programmers”

This update completes the ES2019 edition of this book. In addition to many small improvements, it brings the following changes:

  • Chapter “The big picture”
    • New section “Polyfills: new features on older platforms”
  • Chapter “Variables and assignment”:
    • Rewritten section “Global variables and the global object”
  • Chapter ”Booleans”:
    • Major rewrite of section “Falsy and truthy values”

TypeScript bug when compiling to CommonJS?


  "compilerOptions": {
    "rootDir": "ts",
    "outDir": "dist",
    "target": "es2018",

Teaching the practically useful parts of computer science

I think the practically useful parts of computer science could easily be taught via a book (or similar).

General considerations:

  • I think I only every really learned abstract concepts when I could play with them via a programming language. For example:
    • Logic via Prolog
    • Rewrite rules via Maude
View sequential-concurrent.js
const assert = require('assert');
//========== Helper functions
* Resolves after `ms` milliseconds
function delay(ms) {
return new Promise((resolve, _reject) => {
setTimeout(resolve, ms);
You can’t perform that action at this time.