Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmlweb/mochila
Your Lightweight Travel Companion for TypeScript Programming
https://github.com/jmlweb/mochila
functional-programming typescript utils
Last synced: about 6 hours ago
JSON representation
Your Lightweight Travel Companion for TypeScript Programming
- Host: GitHub
- URL: https://github.com/jmlweb/mochila
- Owner: jmlweb
- Created: 2023-10-28T12:28:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-27T12:14:02.000Z (4 months ago)
- Last Synced: 2024-07-27T20:31:54.628Z (4 months ago)
- Topics: functional-programming, typescript, utils
- Language: TypeScript
- Homepage: https://jmlweb.github.io/mochila/
- Size: 1.26 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🎒 Mochila
Your Lightweight Travel Companion for TypeScript Programming
[Documentation](https://jmlweb.github.io/mochila/modules.html)
## Philosophy
At the core of Mochila's philosophy is the commitment to a "data last" approach in writing functions. This design choice enables easy composition of functions using our internal `pipe` utility.
Additionally, Mochila embraces currying when necessary, allowing functions to be conveniently partially applied. This flexibility enhances the overall usability of the toolkit.
```typescript
import { length, multiply, pipe } from 'mochila-ts';const doubleLength = pipe(length, multiply(2));
doubleLength([1, 2, 3]); // 6
doubleLength('abc'); // 6
```Mochila not only provides robust support for TypeScript but also comes equipped with handy utilities for seamlessly handling tasks such as caching and backpressuring.
```typescript
import { LRUCache } from 'mochila-ts';const cache = new LRUCache({
max: 100,
ttl: 1000 * 60 * 60 * 24,
});
```All the utilities are exposed as named exports from the `mochila-ts` package.
## Installation
```bash
npm install mochila-ts
# or
yarn add mochila-ts
# or
pnpm add mochila-ts
```