@thi.ng/memoize
Advanced tools
Comparing version 4.0.0 to 4.0.1
# Change Log | ||
- **Last updated**: 2024-10-31T22:57:27Z | ||
- **Last updated**: 2024-11-03T16:41:34Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -5,0 +5,0 @@ |
{ | ||
"name": "@thi.ng/memoize", | ||
"version": "4.0.0", | ||
"description": "Function memoization with configurable caching", | ||
"version": "4.0.1", | ||
"description": "Function memoization with configurable caching and support for async functions", | ||
"type": "module", | ||
@@ -48,2 +48,3 @@ "module": "./index.js", | ||
"keywords": [ | ||
"async", | ||
"cache", | ||
@@ -99,3 +100,3 @@ "functional", | ||
}, | ||
"gitHead": "36d88652f6712b0e7ed8e55d1f4d9b3718294f7f\n" | ||
"gitHead": "1148f3130b867c65141957b4b7617021d7ac7fc9\n" | ||
} |
@@ -33,3 +33,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
Function memoization with configurable caching. | ||
Function memoization with configurable caching and support for async functions. | ||
@@ -52,6 +52,6 @@ This package provides different function memoization implementations for | ||
- [doOnce()](https://docs.thi.ng/umbrella/memoize/functions/doOnce.html) | ||
- [memoize()](https://docs.thi.ng/umbrella/memoize/functions/memoize.html) | ||
- [memoize1()](https://docs.thi.ng/umbrella/memoize/functions/memoize1.html) | ||
- [memoizeJ()](https://docs.thi.ng/umbrella/memoize/functions/memoizeJ.html) | ||
- [memoizeO()](https://docs.thi.ng/umbrella/memoize/functions/memoizeO.html) | ||
- [memoize()](https://docs.thi.ng/umbrella/memoize/functions/memoize.html) / [memoizeAsync()](https://docs.thi.ng/umbrella/memoize/functions/memoizeAsync.html) | ||
- [memoize1()](https://docs.thi.ng/umbrella/memoize/functions/memoize1.html) / [memoizeAsync1()](https://docs.thi.ng/umbrella/memoize/functions/memoizeAsync1.html) | ||
- [memoizeJ()](https://docs.thi.ng/umbrella/memoize/functions/memoizeJ.html) / [memoizeAsyncJ()](https://docs.thi.ng/umbrella/memoize/functions/memoizeAsyncJ.html) | ||
- [memoizeO()](https://docs.thi.ng/umbrella/memoize/functions/memoizeO.html) / [memoizeAsyncO()](https://docs.thi.ng/umbrella/memoize/functions/memoizeAsyncO.html) | ||
@@ -131,3 +131,6 @@ ## Status | ||
foo = memoize1((x) => (console.log("exec"), x * 10)); | ||
foo = memoize1((x: number) => { | ||
console.log("exec"); | ||
return x * 10; | ||
}); | ||
@@ -144,3 +147,3 @@ foo(1); | ||
foo = memoize1( | ||
(x) => (console.log("exec"), x[0] * 10), | ||
(x: number[]) => (console.log("exec"), x[0] * 10), | ||
// custom ES6 Map impl which compares by value, not by reference | ||
@@ -155,2 +158,3 @@ new EquivMap() | ||
// would be a cache miss w/ native ES6 Map | ||
// due to lack of value equality semantics | ||
foo([1]); | ||
@@ -163,3 +167,3 @@ // 10 | ||
foo = memoize1( | ||
(x) => (console.log("exec"), x[0] * 10), | ||
(x: number[]) => (console.log("exec"), x[0] * 10), | ||
new LRUCache(null, { maxlen: 3 }) | ||
@@ -176,3 +180,6 @@ ); | ||
const dotProduct = memoize( | ||
(x, y) => (console.log("exec"), x[0] * y[0] + x[1] * y[1]), | ||
(x: number[], y: number[]) => { | ||
console.log("exec"); | ||
return x[0] * y[0] + x[1] * y[1]; | ||
}, | ||
new EquivMap() | ||
@@ -194,7 +201,12 @@ ); | ||
const dotProduct = memoizeJ( | ||
(x, y) => (console.log("exec"), x[0] * y[0] + x[1] * y[1]) | ||
(x: number[], y: number[]) => { | ||
console.log("exec"); | ||
return x[0] * y[0] + x[1] * y[1]; | ||
} | ||
); | ||
dotProduct([1, 2], [3, 4]); | ||
// exec | ||
// 11 | ||
dotProduct([1, 2], [3, 4]); | ||
@@ -201,0 +213,0 @@ // 11 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40193
226