1 repositorio
Adds a match expression to JavaScript for declarative inspection and branching on data structures with destructuring and guards.
Distinct from Structural Pattern Matching: Distinct from Structural Pattern Matching: focuses on the ECMAScript-specific match expression syntax, not general structural pattern matching.
Explore 1 awesome GitHub repository matching programming languages & runtimes · ECMAScript Match Expressions. Refine with filters or upvote what's useful.
This is a TC39 proposal to add declarative pattern matching syntax to the ECMAScript language. It introduces a match expression that allows developers to inspect and branch on data structures using patterns with destructuring, guards, and logical combinators. The proposal defines a custom matcher protocol via a well-known symbol, enabling objects to implement user-defined matching logic with arbitrary extraction and decomposition. The proposal supports matching against literal primitives using SameValue equality with special handling for signed zero and NaN, as well as relational comparison
Proposes a match expression for JavaScript with destructuring, guards, and logical combinators.