@thi.ng/memoize 3.1.19 → 3.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/memoize.d.ts +7 -7
- package/memoize1.d.ts +5 -7
- package/memoize1.js +5 -7
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ This project is part of the
|
|
|
24
24
|
|
|
25
25
|
## About
|
|
26
26
|
|
|
27
|
-
Function memoization with configurable caching
|
|
27
|
+
Function memoization with configurable caching.
|
|
28
28
|
|
|
29
29
|
This package provides different function memoization implementations for
|
|
30
30
|
functions with 1 or more arguments and custom result caching using ES6
|
package/memoize.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import type { Fn, Fn2, Fn3, Fn4 } from "@thi.ng/api";
|
|
|
2
2
|
import type { MapLike } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Function memoization for arbitrary argument counts. Returns augmented
|
|
5
|
-
* function, which uses the given `Map` implementation to obtain and
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* function, which uses the given `Map` implementation to obtain and store
|
|
6
|
+
* memoized result of given args. Supports generics for up to 4 args (otherwise
|
|
7
|
+
* untyped).
|
|
8
8
|
*
|
|
9
|
-
* **Important:** It only makes sense to use `Map` types which support
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* to memory leaks! Alternatively, use {@link
|
|
9
|
+
* **Important:** It only makes sense to use `Map` types which support value
|
|
10
|
+
* (rather than object) equality, e.g. those provided by
|
|
11
|
+
* [`thi.ng/associative`](https://thi.ng/associative). Using a native `Map` type
|
|
12
|
+
* here will lead to memory leaks! Alternatively, use {@link memoizeJ}.
|
|
13
13
|
*
|
|
14
14
|
* @param fn -
|
|
15
15
|
* @param cache -
|
package/memoize1.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
2
|
import type { MapLike } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Optimized memoization for single arg functions. If the function
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* {@link
|
|
9
|
-
* `Map` type here will lead to memory leaks! Alternatively, use
|
|
10
|
-
* {@link (memoizeJ:1)}.
|
|
4
|
+
* Optimized memoization for single arg functions. If the function expects args
|
|
5
|
+
* other than strings or numbers, you MUST provide a `Map` implementation which
|
|
6
|
+
* supports value (rather than object) equality, e.g. one of those provided by
|
|
7
|
+
* [`thi.ng/associative`](https://thi.ng/associative). Using a native `Map` type
|
|
8
|
+
* here will lead to memory leaks! Alternatively, use {@link memoizeJ}.
|
|
11
9
|
*
|
|
12
10
|
* @param fn -
|
|
13
11
|
* @param cache -
|
package/memoize1.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Optimized memoization for single arg functions. If the function
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* {@link
|
|
7
|
-
* `Map` type here will lead to memory leaks! Alternatively, use
|
|
8
|
-
* {@link (memoizeJ:1)}.
|
|
2
|
+
* Optimized memoization for single arg functions. If the function expects args
|
|
3
|
+
* other than strings or numbers, you MUST provide a `Map` implementation which
|
|
4
|
+
* supports value (rather than object) equality, e.g. one of those provided by
|
|
5
|
+
* [`thi.ng/associative`](https://thi.ng/associative). Using a native `Map` type
|
|
6
|
+
* here will lead to memory leaks! Alternatively, use {@link memoizeJ}.
|
|
9
7
|
*
|
|
10
8
|
* @param fn -
|
|
11
9
|
* @param cache -
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/memoize",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.21",
|
|
4
4
|
"description": "Function memoization with configurable caching",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.6.
|
|
37
|
+
"@thi.ng/api": "^8.6.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@microsoft/api-extractor": "^7.33.7",
|
|
41
|
-
"@thi.ng/testament": "^0.3.
|
|
41
|
+
"@thi.ng/testament": "^0.3.8",
|
|
42
42
|
"rimraf": "^3.0.2",
|
|
43
43
|
"tools": "^0.0.1",
|
|
44
44
|
"typedoc": "^0.23.22",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
],
|
|
90
90
|
"year": 2018
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "bc6f7f5e2765bb96fe64db804eaf4b2443b47fc6\n"
|
|
93
93
|
}
|