@naturalcycles/js-lib 15.84.1 → 15.85.0
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/dist/decorators/index.d.ts +2 -2
- package/dist/decorators/index.js +2 -2
- package/dist/decorators/{memoFn.d.ts → memoized.d.ts} +1 -3
- package/dist/decorators/{memoFn.js → memoized.js} +1 -3
- package/dist/decorators/{memoFnAsync.d.ts → memoizedAsync.d.ts} +1 -4
- package/dist/decorators/{memoFnAsync.js → memoizedAsync.js} +1 -4
- package/package.json +1 -1
- package/src/decorators/index.ts +2 -2
- package/src/decorators/{memoFn.ts → memoized.ts} +1 -3
- package/src/decorators/{memoFnAsync.ts → memoizedAsync.ts} +1 -4
|
@@ -6,7 +6,7 @@ export * from './decorator.util.js';
|
|
|
6
6
|
export * from './logMethod.decorator.js';
|
|
7
7
|
export * from './memo.decorator.js';
|
|
8
8
|
export * from './memo.util.js';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
9
|
+
export * from './memoized.js';
|
|
10
|
+
export * from './memoizedAsync.js';
|
|
11
11
|
export * from './retry.decorator.js';
|
|
12
12
|
export * from './timeout.decorator.js';
|
package/dist/decorators/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export * from './decorator.util.js';
|
|
|
6
6
|
export * from './logMethod.decorator.js';
|
|
7
7
|
export * from './memo.decorator.js';
|
|
8
8
|
export * from './memo.util.js';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
9
|
+
export * from './memoized.js';
|
|
10
|
+
export * from './memoizedAsync.js';
|
|
11
11
|
export * from './retry.decorator.js';
|
|
12
12
|
export * from './timeout.decorator.js';
|
|
@@ -8,7 +8,5 @@ export interface MemoizedFunction {
|
|
|
8
8
|
* Only supports Sync functions.
|
|
9
9
|
* To support Async functions - use _memoFnAsync.
|
|
10
10
|
* Technically, you can use it with Async functions, but it'll return the Promise without awaiting it.
|
|
11
|
-
*
|
|
12
|
-
* @experimental
|
|
13
11
|
*/
|
|
14
|
-
export declare function
|
|
12
|
+
export declare function _memoized<FN extends AnyFunction>(fn: FN, opt?: MemoOptions<FN>): FN & MemoizedFunction;
|
|
@@ -3,10 +3,8 @@ import { jsonMemoSerializer, MapMemoCache } from './memo.util.js';
|
|
|
3
3
|
* Only supports Sync functions.
|
|
4
4
|
* To support Async functions - use _memoFnAsync.
|
|
5
5
|
* Technically, you can use it with Async functions, but it'll return the Promise without awaiting it.
|
|
6
|
-
*
|
|
7
|
-
* @experimental
|
|
8
6
|
*/
|
|
9
|
-
export function
|
|
7
|
+
export function _memoized(fn, opt = {}) {
|
|
10
8
|
const { logger = console, cacheFactory = () => new MapMemoCache(), cacheKeyFn = jsonMemoSerializer, } = opt;
|
|
11
9
|
const cache = cacheFactory();
|
|
12
10
|
const memoizedFn = function (...args) {
|
|
@@ -4,7 +4,4 @@ import type { AsyncMemoCache } from './memo.util.js';
|
|
|
4
4
|
export interface MemoizedAsyncFunction {
|
|
5
5
|
cache: AsyncMemoCache;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
* @experimental
|
|
9
|
-
*/
|
|
10
|
-
export declare function _memoFnAsync<FN extends AnyAsyncFunction>(fn: FN, opt: AsyncMemoOptions<FN>): FN & MemoizedAsyncFunction;
|
|
7
|
+
export declare function _memoizedAsync<FN extends AnyAsyncFunction>(fn: FN, opt: AsyncMemoOptions<FN>): FN & MemoizedAsyncFunction;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { MISS } from '../types.js';
|
|
2
2
|
import { jsonMemoSerializer } from './memo.util.js';
|
|
3
|
-
|
|
4
|
-
* @experimental
|
|
5
|
-
*/
|
|
6
|
-
export function _memoFnAsync(fn, opt) {
|
|
3
|
+
export function _memoizedAsync(fn, opt) {
|
|
7
4
|
const { logger = console, cacheFactory, cacheKeyFn = jsonMemoSerializer } = opt;
|
|
8
5
|
const cache = cacheFactory();
|
|
9
6
|
const memoizedFn = async function (...args) {
|
package/package.json
CHANGED
package/src/decorators/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from './decorator.util.js'
|
|
|
6
6
|
export * from './logMethod.decorator.js'
|
|
7
7
|
export * from './memo.decorator.js'
|
|
8
8
|
export * from './memo.util.js'
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
9
|
+
export * from './memoized.js'
|
|
10
|
+
export * from './memoizedAsync.js'
|
|
11
11
|
export * from './retry.decorator.js'
|
|
12
12
|
export * from './timeout.decorator.js'
|
|
@@ -11,10 +11,8 @@ export interface MemoizedFunction {
|
|
|
11
11
|
* Only supports Sync functions.
|
|
12
12
|
* To support Async functions - use _memoFnAsync.
|
|
13
13
|
* Technically, you can use it with Async functions, but it'll return the Promise without awaiting it.
|
|
14
|
-
*
|
|
15
|
-
* @experimental
|
|
16
14
|
*/
|
|
17
|
-
export function
|
|
15
|
+
export function _memoized<FN extends AnyFunction>(
|
|
18
16
|
fn: FN,
|
|
19
17
|
opt: MemoOptions<FN> = {},
|
|
20
18
|
): FN & MemoizedFunction {
|
|
@@ -8,10 +8,7 @@ export interface MemoizedAsyncFunction {
|
|
|
8
8
|
cache: AsyncMemoCache
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
* @experimental
|
|
13
|
-
*/
|
|
14
|
-
export function _memoFnAsync<FN extends AnyAsyncFunction>(
|
|
11
|
+
export function _memoizedAsync<FN extends AnyAsyncFunction>(
|
|
15
12
|
fn: FN,
|
|
16
13
|
opt: AsyncMemoOptions<FN>,
|
|
17
14
|
): FN & MemoizedAsyncFunction {
|