DEV Community

Discussion on: From if/switch to mapped functions (a.k.a. object lookup)

Collapse
 
chesterc314 profile image
Chester Cobus

Thanks this is interesting, I don't know why but when I look at this I think of pattern matching, does JS support pattern matching?

Collapse
 
ddialar profile image
Dailos Rafael Díaz Lara

It doesn't exist like that right now. However it's proposed to the tc39 and this proposal is currently in Stage 1.

github.com/tc39/proposal-pattern-m...

Apparently there are several tries to implement it but I think they are simple patches until it's completely adopted.

bramstein.com/writing/pattern-matc...

Collapse
 
chesterc314 profile image
Chester Cobus

Thanks for looking into it :).