Gathering detailed insights and metrics for async-memoize-one
Gathering detailed insights and metrics for async-memoize-one
Gathering detailed insights and metrics for async-memoize-one
Gathering detailed insights and metrics for async-memoize-one
npm install async-memoize-one
Typescript
Module System
Min. Node Version
Node Version
NPM Version
78.4
Supply Chain
93.9
Quality
75.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
978,751
Last Day
158
Last Week
5,481
Last Month
20,106
Last Year
271,794
MIT License
29 Stars
41 Commits
5 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Sep 07, 2024
Minified
Minified + Gzipped
Latest Version
1.1.8
Package Id
async-memoize-one@1.1.8
Unpacked Size
7.41 kB
Size
3.10 kB
File Count
4
NPM Version
10.5.0
Node Version
20.12.2
Published on
May 09, 2024
Cumulative downloads
Total Downloads
Last Day
-50.8%
158
Compared to previous day
Last Week
26.6%
5,481
Compared to previous week
Last Month
-11.6%
20,106
Compared to previous month
Last Year
61.2%
271,794
Compared to previous year
Memoize the last result, in async way.
async-memoize-one simply remembers the last arguments, and if the function is next called with the same arguments then it returns the previous result.
It's used for micro-caching scenarios, where you want to prevent perform an action previously done during a short period of time.
No need to worry about cache busting mechanisms such as maxAge, maxSize, exclusions and so on which can be prone to memory leaks.
1$ npm install async-memoize-one --save
1const get = require('util').promisify(require('simple-get')) 2const memoizeOne = require('async-memoize-one') 3 4const fetchData = memoizeOne(url => get(`https://api.microlink.io?url=${url}`)) 5 6;(async () => { 7 // fecthing data for first time 8 console.time('fetch') 9 await fetchData('https://example.com/one') 10 console.timeEnd('fetch') 11 12 // served data from cache; no fetching! 13 console.time('fetch') 14 await fetchData('https://example.com/one') 15 console.timeEnd('fetch') 16 17 // previous execution parameters are different, so fetching again 18 console.time('fetch') 19 await fetchData('https://example.com/two') 20 console.timeEnd('fetch') 21 22 // previous execution parameters are different, so fetching again 23 console.time('fetch') 24 await fetchData('https://example.com/one') 25 console.timeEnd('fetch') 26})()
Required
Type: function
Promise-returning or async function to be memoized.
Type: function
Default: fast-deep-equal
The compare function to determinate if both executions are the same.
An equality function should return true if the arguments are equal. If true is returned then the wrapped function will not be called.
Type: boolean
Default: false
Cache rejected promises.
async-memoize-one © microlink.io, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.
microlink.io · GitHub microlink.io · Twitter @microlinkhq
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 1/20 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More