An educational pure functional programming library in TypeScript
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Format markdown table in examples README

+6 -6
+6 -6
examples/README.md
··· 46 46 47 47 **Showcases:** Branded types, refinements, typestate, Result, pattern matching 48 48 49 - | Problem | Vanilla JS/TS | purus-ts | 50 - |---------|---------------|----------| 51 - | ID mixups | `processOrder(orderId, userId)` - args swappable | `processOrder(orderId: OrderId, userId: UserId)` - compiler catches | 52 - | Invalid quantities | `if (qty > 0)` checks everywhere | `PositiveInt` type - validated at construction | 53 - | State transitions | `if (order.status === 'paid')` | `ship(order: PaidOrder)` - can't ship unpaid | 54 - | Error handling | Switch with forgotten cases | `match()` forces exhaustive handling | 49 + | Problem | Vanilla JS/TS | purus-ts | 50 + |--------------------|--------------------------------------------------|---------------------------------------------------------------------| 51 + | ID mixups | `processOrder(orderId, userId)` - args swappable | `processOrder(orderId: OrderId, userId: UserId)` - compiler catches | 52 + | Invalid quantities | `if (qty > 0)` checks everywhere | `PositiveInt` type - validated at construction | 53 + | State transitions | `if (order.status === 'paid')` | `ship(order: PaidOrder)` - can't ship unpaid | 54 + | Error handling | Switch with forgotten cases | `match()` forces exhaustive handling | 55 55 56 56 ```typescript 57 57 // Can't ship an unpaid order - compile error!