@thi.ng/memoize
Advanced tools
Comparing version
@@ -12,1 +12,2 @@ export declare type Fn0<T> = () => T; | ||
} | ||
//# sourceMappingURL=api.d.ts.map |
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/memoize@1.1.6...@thi.ng/memoize@1.1.7) (2020-01-24) | ||
**Note:** Version bump only for package @thi.ng/memoize | ||
## [1.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/memoize@1.1.5...@thi.ng/memoize@1.1.6) (2019-11-30) | ||
@@ -8,0 +16,0 @@ |
@@ -13,5 +13,6 @@ import { Fn0 } from "./api"; | ||
* | ||
* @param id | ||
* @param factory | ||
* @param id - | ||
* @param factory - | ||
*/ | ||
export declare const defonce: <T>(id: string, factory: Fn0<T>) => T; | ||
//# sourceMappingURL=defonce.d.ts.map |
@@ -13,5 +13,5 @@ const cache = {}; | ||
* | ||
* @param id | ||
* @param factory | ||
* @param id - | ||
* @param factory - | ||
*/ | ||
export const defonce = (id, factory) => cache.hasOwnProperty(id) ? cache[id] : (cache[id] = factory()); |
@@ -6,1 +6,2 @@ export * from "./api"; | ||
export * from "./memoizej"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,7 +10,7 @@ import { Fn1, Fn2, Fn3, Fn4, MapLike } from "./api"; | ||
* value (rather than object) equality, e.g. those provided by | ||
* thi.ng/associative. Using a native `Map` type here will lead to | ||
* memory leaks! Alternatively, use `memoizeJ`. | ||
* {@link @thi.ng/associative# | @thi.ng/associative}. Using a native `Map` type here will lead | ||
* to memory leaks! Alternatively, use {@link (memoizeJ:1)}. | ||
* | ||
* @param fn | ||
* @param cache | ||
* @param fn - | ||
* @param cache - | ||
*/ | ||
@@ -21,1 +21,2 @@ export declare function memoize<A, B>(fn: Fn1<A, B>, cache: MapLike<A, B>): Fn1<A, B>; | ||
export declare function memoize<A, B, C, D, E>(fn: Fn4<A, B, C, D, E>, cache: MapLike<[A, B, C, D], E>): Fn4<A, B, C, D, E>; | ||
//# sourceMappingURL=memoize.d.ts.map |
@@ -6,9 +6,11 @@ import { Fn1, MapLike } from "./api"; | ||
* implementation which supports value (rather than object) equality, | ||
* e.g. one of those provided by thi.ng/associative. Using a native | ||
* e.g. one of those provided by | ||
* {@link @thi.ng/associative# | @thi.ng/associative}. Using a native | ||
* `Map` type here will lead to memory leaks! Alternatively, use | ||
* `memoizeJ`. | ||
* {@link (memoizeJ:1)}. | ||
* | ||
* @param fn | ||
* @param cache | ||
* @param fn - | ||
* @param cache - | ||
*/ | ||
export declare function memoize1<A, B>(fn: Fn1<A, B>, cache?: MapLike<A, B>): (x: A) => B; | ||
//# sourceMappingURL=memoize1.d.ts.map |
@@ -5,8 +5,9 @@ /** | ||
* implementation which supports value (rather than object) equality, | ||
* e.g. one of those provided by thi.ng/associative. Using a native | ||
* e.g. one of those provided by | ||
* {@link @thi.ng/associative# | @thi.ng/associative}. Using a native | ||
* `Map` type here will lead to memory leaks! Alternatively, use | ||
* `memoizeJ`. | ||
* {@link (memoizeJ:1)}. | ||
* | ||
* @param fn | ||
* @param cache | ||
* @param fn - | ||
* @param cache - | ||
*/ | ||
@@ -13,0 +14,0 @@ export function memoize1(fn, cache) { |
@@ -12,4 +12,4 @@ import { IObjectOf } from "@thi.ng/api"; | ||
* | ||
* @param fn | ||
* @param cache | ||
* @param fn - | ||
* @param cache - | ||
*/ | ||
@@ -20,1 +20,2 @@ export declare function memoizeJ<A, B>(fn: Fn1<A, B>, cache?: IObjectOf<B>): Fn1<A, B>; | ||
export declare function memoizeJ<A, B, C, D, E>(fn: Fn4<A, B, C, D, E>, cache?: IObjectOf<E>): Fn4<A, B, C, D, E>; | ||
//# sourceMappingURL=memoizej.d.ts.map |
{ | ||
"name": "@thi.ng/memoize", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Function memoization with configurable caching", | ||
@@ -26,16 +26,18 @@ "module": "./index.js", | ||
"doc": "node_modules/.bin/typedoc --mode modules --out doc src", | ||
"doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose", | ||
"pub": "yarn build:release && yarn publish --access public" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^12.12.11", | ||
"mocha": "^6.2.2", | ||
"nyc": "^14.0.0", | ||
"ts-node": "^8.5.2", | ||
"typedoc": "^0.15.2", | ||
"typescript": "^3.7.2" | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@microsoft/api-extractor": "^7.7.7", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^13.5.0", | ||
"mocha": "^7.0.0", | ||
"nyc": "^15.0.0", | ||
"ts-node": "^8.6.2", | ||
"typedoc": "^0.16.8", | ||
"typescript": "^3.7.5" | ||
}, | ||
"dependencies": { | ||
"@thi.ng/api": "^6.6.0" | ||
"@thi.ng/api": "^6.7.0" | ||
}, | ||
@@ -56,3 +58,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "36c4d9e967bd80ccdbfa0f4a42f594080f95f105" | ||
"gitHead": "93d8af817724c1c5b06d80ffa2492fe5b4fb7bc4" | ||
} |
@@ -20,3 +20,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
- [Arbitrary args](#arbitrary-args) | ||
- [Via JSON.stringify()](#via-json-stringify--) | ||
- [Via JSON.stringify()](#via-jsonstringify) | ||
- [Authors](#authors) | ||
@@ -34,5 +34,5 @@ - [License](#license) | ||
semantics** (e.g. those provided by | ||
[@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/master/packages/associative)) | ||
[@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/develop/packages/associative)) | ||
or | ||
[@thi.ng/cache](https://github.com/thi-ng/umbrella/tree/master/packages/cache)). | ||
[@thi.ng/cache](https://github.com/thi-ng/umbrella/tree/develop/packages/cache)). | ||
The latter also support automatically pruning of memoization caches, | ||
@@ -51,5 +51,7 @@ based on different strategies. See doc strings for further details. | ||
Package sizes (gzipped): ESM: 0.2KB / CJS: 0.3KB / UMD: 0.4KB | ||
## Dependencies | ||
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) | ||
- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/develop/packages/api) | ||
@@ -59,3 +61,3 @@ ## Usage examples | ||
Several demos in this repo's | ||
[/examples](https://github.com/thi-ng/umbrella/tree/master/examples) | ||
[/examples](https://github.com/thi-ng/umbrella/tree/develop/examples) | ||
directory are using this package. | ||
@@ -65,5 +67,11 @@ | ||
### multitouch <!-- NOTOC --> | ||
Basic @thi.ng/rstream-gestures multi-touch demo | ||
[Live demo](https://demo.thi.ng/umbrella/multitouch/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/multitouch) | ||
### rstream-spreadsheet <!-- NOTOC --> | ||
[Live demo](https://demo.thi.ng/umbrella/rstream-spreadsheet/) | [Source](https://github.com/thi-ng/umbrella/tree/master/examples/rstream-spreadsheet) | ||
[Live demo](https://demo.thi.ng/umbrella/rstream-spreadsheet/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/rstream-spreadsheet) | ||
@@ -145,2 +153,2 @@ ## API | ||
© 2018 - 2019 Karsten Schmidt // Apache Software License 2.0 | ||
© 2018 - 2020 Karsten Schmidt // Apache Software License 2.0 |
@@ -21,5 +21,5 @@ # ${pkg.name} | ||
semantics** (e.g. those provided by | ||
[@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/master/packages/associative)) | ||
[@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/develop/packages/associative)) | ||
or | ||
[@thi.ng/cache](https://github.com/thi-ng/umbrella/tree/master/packages/cache)). | ||
[@thi.ng/cache](https://github.com/thi-ng/umbrella/tree/develop/packages/cache)). | ||
The latter also support automatically pruning of memoization caches, | ||
@@ -42,2 +42,4 @@ based on different strategies. See doc strings for further details. | ||
${pkg.size} | ||
## Dependencies | ||
@@ -44,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
181
1.12%149
5.67%34072
-7.47%9
12.5%21
-22.22%Updated