4 ms·
What I really miss when doing "functional JS" is pattern matching. Is there any good solution for that?
by kailuowang 14y ago
What I really miss when doing "functional JS" is pattern matching. Is there any good solution for that?
- goldfeld 14y agoHave you seen matches.js? https://news.ycombinator.com/item?id=4516576 https://news.ycombinator.com/item?id=4516576
- kailuowang 14y agoIt looks great. Thanks for the link!
- coldtea 14y agoYou might try this one: http://www.bramstein.com/projects/funcy/ http://www.bramstein.com/projects/funcy/ It implements pattern matching in JS, with objects and closures. Not as convenient as first class support, but might be worth it.
- bsimpson 14y agoThat link is overloaded. Try this one: https://github.com/bramstein/funcy https://github.com/bramstein/funcy
- fogus 14y agoI also really miss pattern matching and I think that JavaScript would be well-served by it or even minimally some sort of destructuring.