Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: OCaml-like pattern-matching with vanilla JavaScript (no transpiler)
3 points by aylmao 39 days ago | hide | past | favorite | 1 comment
A few years back I wrote a little library that implements OCaml-inspired pattern matching using just plan JavaScript destructuring syntax. I don't think I ever shared it here. Thought you might find it interesting.

I did this just for fun, don't use it in prod. It's very inefficient. Have a look at the source for a chuckle, it's a single 145 line file.

Link: https://github.com/mrkev/fnMatch

Playground: https://aykev.dev/fnMatch/




That looks pretty great! I would love to use this at work if functional programming idioms were already familiar to the team and I didn't face resistance introducing them. Thank you for sharing and developing the library.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: