Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anwesh43/memoize_promise_call
Don't promise the same thing again 🙅. Memoize it 💪
https://github.com/anwesh43/memoize_promise_call
memoization node nodejs npm promise
Last synced: 9 days ago
JSON representation
Don't promise the same thing again 🙅. Memoize it 💪
- Host: GitHub
- URL: https://github.com/anwesh43/memoize_promise_call
- Owner: Anwesh43
- Created: 2017-10-16T13:38:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-16T14:45:38.000Z (about 7 years ago)
- Last Synced: 2024-11-01T14:47:09.799Z (14 days ago)
- Topics: memoization, node, nodejs, npm, promise
- Language: JavaScript
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.MD
Awesome Lists containing this project
README
# memoize_promise_call
### Don't promise the same thing again 🙅. Memoize it 💪
### Why we need to memoization?
#### there are situation where the client makes the same promise call again and again. Imagine if there is a critical promise call which takes a lot of time and we make the same call again how much of your client's precious time will be lost 😱. To avoid this we should memoize 👌.
### Usage
```
const memoizePromise = require('memoize_promise_call').memoizePromisefetch = memoziePromise(fetch)
fetch('https://www.example.org').then((res)=>res.json()).then((data)=>{
//Do something here
})// 2nd time it won't make the request simply give you the response
fetch('https://www.example.org').then((res)=>res.json()).then((data)=>{
//Do something here
})s
```