|
|
|
|
|
by cshepp
2985 days ago
|
|
Pattern matching would be a great addition to JS. I built a pattern matching library[1] with a very similar syntax back in 2015 (although I will be the first to admit that it's a naive implementation). It makes validating/traversing deeply-nested objects much less verbose. I'm excited to see where this proposal goes. [1] https://github.com/cshepp/Kasai |
|
Example:
Works also on deeply nested objects.[1] https://github.com/MarkusPfundstein/pmatch-js