Getting rid of OOP in Javascript with lodash/fp
One of the things I dislike about JavaScript is how it intertwines object-oriented paradigm with functional programming. Ironically, that’s also the thing that I do like about JS. I like that I have a choice and JS actually does allow you to write functional code that looks natural (as opposed to Ruby that doesn’t even have actual functions per se).
However, the standard library in JavaScript is written in a OOP manner, meaning
that you need to call methods on objects instead of using functions. This
creates inconsistency when you write in functional style because you end up with
code that uses both functions end methods: getUsers(ids).map(userToJson)
.
I’d much rather prefer to have a consistent function-oriented code. Lodash, defining a lot of commonly-used functions, basically provides functional alternative to JS methods from standard library.