1 repositorio
Tests that a subject is iterable with a specific number of items, matching each against sub-patterns and optionally collecting remaining items with a rest pattern.
Distinct from Structural Pattern Matching: Distinct from Structural Pattern Matching: focuses on iterable length and rest collection rather than AST code fragment matching.
Explore 1 awesome GitHub repository matching programming languages & runtimes · Iterable Structure Matching. 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
Matches iterable structures by length, element sub-patterns, and optional rest collection.