Hacker News new | ask | show | jobs
by stankalank 4434 days ago
I found your section on converting prototype methods into utility functions really interesting, I found myself doing the same thing a few days ago. One suggestion for your 'demethodize' function is to replace the prototype methods you use with purely functional versions (AKA replace [].slice and fn.apply). It seems kind of funky to have a function dedicated to demethodizing prototype methods that makes use of prototype methods!
1 comments

Yeah, I think I sometimes weave back-and-forth. I try to avoid thinking about "micro-optimizations", but can't help myself. As I'm writing this series I'm compiling together a small and opinionated library that uses a lot of these concepts, and I am tending to use native methods, for loops, while loops etc. in favor of performance....

but I should probably stop that and instead favor the clean code following the very principles they are there to promote! One of my points was that performance doesn't really matter here anyway.

Thanks for pointing out. I might update a couple spots.