Skip to content

This project contains some design patterns in TypeScript

Notifications You must be signed in to change notification settings

MkkCreations/Design_Patterns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns

To initialize the project do:

    npm install

Singleton

To see the output accede to the Singleton directory and run:

    npx ts-node index.ts

See the output example:

    ==================== Refused ====================
    [ 29/5/2023 21:10:08 ] : 123456789: Debit  | amount -2000€  | Not enough: available 1500€
    [ 29/5/2023 21:10:08 ] : 987654321: Debit  | amount -500€  | Not enough: available 400€
    ==================== Accepted ====================
    [ 29/5/2023 21:10:08 ] : 123456789: Debit  | amount -1000€
    [ 29/5/2023 21:10:08 ] : 123456789: Credit | amount  2000€
    [ 29/5/2023 21:10:08 ] : 123456789: Debit  | amount -500€
    [ 29/5/2023 21:10:08 ] : 987654321: Debit  | amount -100€
    [ 29/5/2023 21:10:08 ] : 987654321: Debit  | amount -500€
    [ 29/5/2023 21:10:08 ] : 987654321: Credit | amount  200€

Observer

To see the output accede to the Observer directory and run:

    npx ts-node index.ts

See the output example:

    0°C
    16%
      20.00 ┼                   ╭─╮                   
      19.00 ┤                 ╭─╯ │                   
      18.00 ┤               ╭─╯   ╰─╮                 
      17.00 ┤             ╭─╯       │                 
      16.00 ┼╮          ╭─╯         ╰─╮            ╭─ 
      15.00 ┤╰─╮      ╭─╯             │          ╭─╯  
      14.00 ┤  ╰─╮  ╭─╯               ╰─╮      ╭─╯    
      13.00 ┤    ╰─╮╯                   │    ╭─╯      
      12.00 ┤   ╭─╯╰─╮                  ╰─╮╭─╯        
      11.00 ┤ ╭─╯    ╰─╮                 ╭─╯          
      10.00 ┼─╯        ╰─╮             ╭─╯╰─╮         
       9.00 ┤            ╰─╮         ╭─╯    │         
       8.00 ┤              ╰─╮     ╭─╯      ╰─╮       
       7.00 ┤                ╰─╮ ╭─╯          │       
       6.00 ┤                  ╰─╯            ╰─╮     
       5.00 ┤                                   │     
       4.00 ┤                                   ╰─╮   
       3.00 ┤                                     │   
       2.00 ┤                                     ╰─╮ 
       1.00 ┤                                       │ 
       0.00 ┤                                       ╰ 

Proxy

To see the output accede to the Proxy directory and run:

    npx ts-node index.ts

See the output example:

    User is not root
    Executing command: ls
    You are not allowed to execute << rm >> command
    ------------------------------
    User is root
    Executing command: ls
    Executing command: rm

About

This project contains some design patterns in TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published