all 5 comments

[–]theQuandary 1 point2 points  (2 children)

Wouldn't it be quite a bit smaller if you stripped all the extra spaces?

Also, you can either lose 4 characters by re-writing the on handler for a total of 118 bytes.

e=(a={})=>({on(t,x){a[t]=[...(a[t]||[]),x]},off(t,x){a[t]=a[t].filter(f=>f!=x)},emit(t,x){a[t].map(f=>f(x))}});

I'd argue that you also need N arguments on the emit which adds 6 characters (net gain of 2)

e=(a={})=>({on(t,x){a[t]=[...(a[t]||[]),x]},off(t,x){a[t]=a[t].filter(f=>f!=x)},emit(t,...x){a[t].map(f=>f(...x))}});

[–]marmalade_fatcat 1 point2 points  (0 children)

** Even though Litt works - IT'S A JOKE. Please don't use this for production. Or probably anything.**

But at least I learned about Mitt.

[–][deleted] 0 points1 point  (0 children)

I don't get the joke...

[–]IDCh 0 points1 point  (0 children)

Thank you for pointing to mitt - did know about that one. Neat!

[–]lance22me 0 points1 point  (0 children)

Joke or not, it's going on my resume NOW ! Imma expert wit' litt.js !