Pattern Matching in JS
summary
JavaScript gains a stage 1 proposal for pattern matching that borrows destructuring to replace brittle switch logic, adding a when keyword and variable binding so reducers and callbacks can match {type, data} without eager evaluation bugs (no more state + undefined on reset). Implementation experiments include a SweetJS macro and a Babel plugin PR, and the spec lives as issues on the TC39 GitHub; the concrete claim is safer, clearer case handling and practical tooling to try it today.
AI-written summary · about
chapters (21)
- 0:00Intro
- 2:55Switch Statements
- 5:29Ternary Statements
- 7:06Object Literal
- 8:38Redux Reducers
- 9:46Switch Statement
- 10:38Destructuring
- 12:27Elm
- 13:13Rust
- 13:35Elixir
- 14:05Water Bottle
- 14:59JavaScript
- 16:18Default Values
- 17:28Arrays
- 18:11Rest Argument
- 18:55UpdateState
- 19:42Destructuring Action
- 20:23Variable Assignment
- 21:23Node
- 22:44Conditionals
- 23:40Where is Pattern Matching
related talks
32mPattern matching in JavaScript
52mJavaScript Design Patterns
31mBack to the future of JS: the next features and amazing proposals
26mBack to the Future of JS II
56mJavaScript Patterns for 2017
11mWhat's cooking for JavaScript: a look at current TC39 proposals
01mEstruturas condicionais do JavaScript
34mFunctional JavaScript for everyone
