A repository of common design patterns written in Typescript.
Credits:
Node and Yarn is required.
yarn installto install dependencies- (Optional) Install Prettier VSCode extension, if you want to play around while keeping code consistency
Choose a design pattern by changing the enum in the example variable in src/index.ts.
enum DesignPattern {
FACTORY = 'factory',
MEMENTO = 'memento',
STATE = 'state',
ITERATOR = 'iterator',
COMPOSITE = 'composite',
BRIDGE = 'bridge',
MEDIATOR = 'mediator',
PROXY = 'proxy',
CHAIN_OF_RESPONSIBILITY = 'chain',
FLYWEIGHT = 'flyweight',
}
const example: DesignPattern = DesignPattern.FLYWEIGHT // Edit here
yarn buildto transpile Typescript to Javascriptyarn startto run the script- (Optional)
yarn devto run a nodemon development server