Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swissmanu/pattern-matching-with-typescript
TypeScript does not have any pattern matching functionality built in. This article shows several ways how you can replicate the core of a simple pattern matcher using a few simple structures and functions within TypeScript. Resulting code will have improved maintainability and better runtime type safety when done right.
https://github.com/swissmanu/pattern-matching-with-typescript
article maintainability pattern-matching typescript
Last synced: 3 months ago
JSON representation
TypeScript does not have any pattern matching functionality built in. This article shows several ways how you can replicate the core of a simple pattern matcher using a few simple structures and functions within TypeScript. Resulting code will have improved maintainability and better runtime type safety when done right.
- Host: GitHub
- URL: https://github.com/swissmanu/pattern-matching-with-typescript
- Owner: swissmanu
- License: mit
- Created: 2017-06-07T20:01:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-10T12:14:08.000Z (over 5 years ago)
- Last Synced: 2024-08-04T01:28:19.007Z (5 months ago)
- Topics: article, maintainability, pattern-matching, typescript
- Language: JavaScript
- Homepage: https://alabor.me/2017/07/05/pattern-matching-with-typescript.html
- Size: 128 KB
- Stars: 72
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - pattern-matching-with-typescript
README
# Pattern Matching with TypeScript
> [TypeScript](https://www.typescriptlang.org/index.html) does not have any pattern matching functionality built in. This article shows several ways how you can replicate the core of a simple pattern matcher using a few simple structures and functions within TypeScript.
>
> Resulting code will have improved maintainability and better runtime type safety when done right.This is the backing repository for the article "Pattern Matching with TypeScript" published under https://alabor.me/2017/07/05/pattern-matching-with-typescript.html
## Examples
The `examples/` directory contains example code which goes along with the article read. Every example is fully executable.
You can run the examples by cloning or downloading this repository. Run `npm install` to install [TypeScript](https://www.typescriptlang.org/index.html) and [Jest](https://facebook.github.io/jest/). `npm test` executes the test suite for the examples.
😎 Pro tip: Run `npm test -- --watch` if you want to tinker with the code and rerun the test suite automatically.
## Article
Github Pages is used to serve the article to you. You find its text and all assets in the `gh-pages` branch.
## Credits
❤️ Thanks to my reviewers for advises and proofreading:
* [@dbrack](https://github.com/dbrack)
* [@mweibel](https://github.com/mweibel)