https://github.com/akbarsaputrait/ngememoize
Ngememoize: Angular Memoization Library
https://github.com/akbarsaputrait/ngememoize
Last synced: about 2 months ago
JSON representation
Ngememoize: Angular Memoization Library
- Host: GitHub
- URL: https://github.com/akbarsaputrait/ngememoize
- Owner: akbarsaputrait
- License: mit
- Created: 2024-12-31T13:34:23.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-08-14T15:48:36.000Z (3 months ago)
- Last Synced: 2025-08-14T17:34:05.288Z (3 months ago)
- Language: TypeScript
- Homepage: https://ngememoize.vercel.app/
- Size: 1.16 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-angular - ngememoize - Easily boost the performance of your Angular applications by memoizing functions and getters with this lightweight and simple-to-use library. (Development Utilities / Performance)
- fucking-awesome-angular - ngememoize - Easily boost the performance of your Angular applications by memoizing functions and getters with this lightweight and simple-to-use library. (Development Utilities / Performance)
README
# Ngememoize: Angular Memoization Library
\
Easily boost the performance of your Angular applications by memoizing functions and getters with this lightweight and simple-to-use library.
## โจ Features
- **Memoize Functions**: Cache function results for improved performance.
- **Lightweight**: Designed for efficiency without adding unnecessary overhead.
- **Decorator Support**: Memoization is as simple as adding a decorator.
- **Angular Compatible**: Fully supports Angular 19 and later.
- **Tree Shakable**: Only include what you need.
---
## ๐ฆ Installation
To get started, install Ngememoize via npm:
```bash
npm install ngememoize
```
Or, if you use Yarn or PNPM:
```bash
yarn add ngememoize
# or
pnpm add ngememoize
```
---
## ๐ Quick Start
### Memoize a Function
```typescript
import { Ngememoize } from 'ngememoize';
// Method example
@Ngememoize({
debugLabel: 'processData'
})
processData(value: number): number {
console.log('Processing...');
return value * 2;
}
// Async method example
@Ngememoize({
debugLabel: 'fetchData',
maxAge: 5000
})
async fetchData(id: string): Promise {
console.log('Fetching...');
return new Promise(resolve =>
setTimeout(() => resolve(`Data for ${id}`), 1000)
);
}
```
For more examples on how to use Ngememoize, please refer to the `/projects/example` directory.
---
## ๐งช Testing
To ensure everything works perfectly, tests are included. Run the following commands:
```bash
npm test
```
---
## ๐ Documentation
### Memoization Decorator
- **@Ngememoize**: Use this decorator on functions or getters to enable memoization.
### Cache Behavior
- Cached results are invalidated when parameters or getter states change.
---
## ๐ฏ Benefits
- **Performance Boost**: Reduce redundant computations.
- **Cleaner Code**: Simplify logic by reducing manual caching.
- **Angular Ready**: Seamlessly integrates with your Angular projects.
---
## ๐ง Contributing
We welcome contributions! Here's how you can help:
1. Fork the repository.
2. Create a feature branch: `git checkout -b feature/awesome-feature`
3. Commit your changes: `git commit -m 'Add awesome feature'`
4. Push to the branch: `git push origin feature/awesome-feature`
5. Open a Pull Request.
---
## ๐ License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
---
## ๐คฉ Credits
Ngememoize was built with โค๏ธ by developers who love Angular and believe in the power of simplicity and efficiency.
---
## ๐ Support
If you find this library helpful, consider giving it a โญ on [GitHub](https://github.com/akbarsaputrait/ngememoize). Your support means a lot!
[](https://www.buymeacoffee.com/akbarsaputrait)
---
Now go forth and **memoize** your way to blazing-fast Angular apps! ๐