https://github.com/torokmark/design_patterns_in_typescript
:triangular_ruler: Design pattern implementations in TypeScript
https://github.com/torokmark/design_patterns_in_typescript
adapter builder command composite design-patterns facade typescript
Last synced: 3 days ago
JSON representation
:triangular_ruler: Design pattern implementations in TypeScript
- Host: GitHub
- URL: https://github.com/torokmark/design_patterns_in_typescript
- Owner: torokmark
- License: mit
- Created: 2013-07-07T21:49:06.000Z (almost 12 years ago)
- Default Branch: main
- Last Pushed: 2023-09-05T02:44:07.000Z (over 1 year ago)
- Last Synced: 2025-04-11T05:09:40.830Z (3 days ago)
- Topics: adapter, builder, command, composite, design-patterns, facade, typescript
- Language: TypeScript
- Homepage: http://torokmark.github.io/design_patterns_in_typescript/
- Size: 78.1 KB
- Stars: 5,297
- Watchers: 174
- Forks: 763
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-list - design_patterns_in_typescript
- awesome-design-patterns - TypeScript设计模式
- awesome-design-patterns - TypeScript设计模式
- stars - torokmark/design_patterns_in_typescript - :triangular_ruler: Design pattern implementations in TypeScript (TypeScript)
README
# Design Patterns in TypeScript #
Here are the implementations of the following design patterns in TypeScript:
### Creational ###
* [Singleton](https://github.com/torokmark/design_patterns_in_typescript/tree/master/singleton)
* [Abstract Factory](https://github.com/torokmark/design_patterns_in_typescript/tree/master/abstract_factory)
* [Factory Method](https://github.com/torokmark/design_patterns_in_typescript/tree/master/factory_method)
* [Builder](https://github.com/torokmark/design_patterns_in_typescript/tree/master/builder)
* [Prototype](https://github.com/torokmark/design_patterns_in_typescript/tree/master/prototype)### Structural Patterns ###
* [Adapter](https://github.com/torokmark/design_patterns_in_typescript/tree/master/adapter)
* [Bridge](https://github.com/torokmark/design_patterns_in_typescript/tree/master/bridge)
* [Composite](https://github.com/torokmark/design_patterns_in_typescript/tree/master/composite)
* [Decorator](https://github.com/torokmark/design_patterns_in_typescript/tree/master/decorator)
* [Facade](https://github.com/torokmark/design_patterns_in_typescript/tree/master/facade)
* [Flyweight](https://github.com/torokmark/design_patterns_in_typescript/tree/master/flyweight)
* [Proxy](https://github.com/torokmark/design_patterns_in_typescript/tree/master/proxy)### Behavioral Patterns ###
* [Chain of Responsibility](https://github.com/torokmark/design_patterns_in_typescript/tree/master/chain_of_responsibility)
* [Command](https://github.com/torokmark/design_patterns_in_typescript/tree/master/command)
* [Interpreter](https://github.com/torokmark/design_patterns_in_typescript/tree/master/interpreter)
* [Iterator](https://github.com/torokmark/design_patterns_in_typescript/tree/master/iterator)
* [Mediator](https://github.com/torokmark/design_patterns_in_typescript/tree/master/mediator)
* [Memento](https://github.com/torokmark/design_patterns_in_typescript/tree/master/memento)
* [Observer](https://github.com/torokmark/design_patterns_in_typescript/tree/master/observer)
* [State](https://github.com/torokmark/design_patterns_in_typescript/tree/master/state)
* [Strategy](https://github.com/torokmark/design_patterns_in_typescript/tree/master/strategy)
* [Template Method](https://github.com/torokmark/design_patterns_in_typescript/tree/master/template_method)
* [Visitor](https://github.com/torokmark/design_patterns_in_typescript/tree/master/visitor)## Compile the project
```
$ git clone https://github.com/torokmark/design_patterns_in_typescript.git
$ cd design_patterns_in_typescript
$ tsc
```There is a `tsconfig.json` file in the root directory which is responsible for the compiler options.
As it is set the default target is Ecmascript5 now.
Any additional options come here.
By default the output is a `patterns.js` file.
To compile only one pattern, use the following command.
```
$ cd design_patterns_in_typescript/visitor
$ tsc --target ES5 --module system --outFile visitor.js visitor.ts
```## Execute the project
After the compilation of the project, a `patterns.js` is generated by default.
Executing the file is:```
node patterns.js
```