DEV Community

Discussion on: Pattern matching in JavaScript

Collapse
 
pclundaahl profile image
Patrick Charles-Lundaahl

I'd wager it would be pretty straightforward to build a library to do this. I built something similar to verify json against user-defined schemas. You could extend that idea to check conditions or pass arguments into a callback on success.

Collapse
 
maxart2501 profile image
Massimo Artizzu

There's something about in Lodash:
lodash.com/docs/4.17.11#cond

Collapse
 
pclundaahl profile image
Patrick Charles-Lundaahl

Neat! I've never actually used lodash, but it looks like it has some really nice utility methods.