match-when - Pattern Matching for Modern JavaScript

I was working on an internal tool at iAdvize during our hack days (fr). This tool is representing our micro-service architecture and every of its components in a near real-time graph (I may open-source it in the future).

Somewhere in the graph relationship code I thought wait a minute, would it be awesome to use some pattern-matching there? So I tried to write some syntax that could exist for it...

... and of course it failed.

It was 6PM so the good news was I would have all the time I wanted to see if it could be possible to implement a pattern-matching solution that was both syntaxically short, would work well with functional-style code while using JavaScript ES6 features for conciseness.

I ended up with this syntax:

Which works also that way:

Underneath it uses enhanced object literals, symbols and, sadly, JSON serialization/deserialization to pass object properties.

Later that night match-when was available on Github.


Managing various NodeJS version per projects

How to manage multiple projects with their own NodeJS version? 

Simple, use nvm.

But how do I automatically change NodeJS version?

Simple use a .nvmrc inside each project and a .env loaded by autoenv when cding inside the project to automatically change NodeJS version between project just by using cd.

It's not DRY, I want to stay DRY and don't duplicate NodeJS version inside both package.json and .nvmrc, what do I do?

Well, remove your .nvmrc and replace .env content by:

And now you're DRY :)
Made with on a hot august night.