{"repo":"gvergnaud/ts-pattern","free":true,"listed":false,"github":"https://github.com/gvergnaud/ts-pattern","clone":"git clone https://github.com/gvergnaud/ts-pattern.git","description":"🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference.","language":"TypeScript","stars":15127,"topics":["pattern-matching","typescript","ts","pattern","matching","inference","type-inference","exhaustive","conditions","branching"],"license":"MIT","category":"machine-learning","readme_excerpt":"TS-Pattern The exhaustive Pattern Matching library for TypeScript with smart type inference. About Write better and safer conditions . Pattern matching lets you express complex conditions in a single, compact expression. Your code becomes shorter and more readable . Exhaustiveness checking ensures you haven’t forgotten any possible case . Animation by @nicoespeon Features - Pattern-match on any data structure : nested Objects, Arrays, Tuples, Sets, Maps and all primitive types. - Typesafe , with helpful type inference. - Exhaustiveness checking support, enforcing that you are matching every possible case with .exhaustive() . - Use patterns to validate the shape of your data with isMatching . - Expressive API , with catch-all and type specific wildcards : P. , P.string , P.number , etc. - Supports predicates , unions , intersections and exclusion patterns for non-trivial cases. - Supports properties selection, via the P.select(name?) function. - Tiny bundle footprint ( only 2kB ). What is Pattern Matching? Pattern Matching is a code-branching technique coming from functional programming languages that's more powerful and often less verbose than imperative alternatives (if/else/switch statements), especially for complex conditions. Pattern Matching is implemented in Python, Rust, Swift, Elixir, Haskell and many other languages. There is a tc39 proposal to add Pattern Matching to EcmaScript, but it is still in stage 1 and isn't likely to land before several years. Luckily, patte","default_branch":null,"files":null,"tree":[],"storefront":"/r/gvergnaud","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/gvergnaud/ts-pattern/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}