update, text, response
This commit is contained in:
94
node_modules/memoizee/CHANGELOG.md
generated
vendored
Normal file
94
node_modules/memoizee/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.4.17](https://github.com/medikoo/memoizee/compare/v0.4.16...v0.4.17) (2024-05-24)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix node version declaration ([15ece26](https://github.com/medikoo/memoizee/commit/15ece26de3e7cc949ebe67b62e21edaa89101480))
|
||||
|
||||
### [0.4.16](https://github.com/medikoo/memoizee/compare/v0.4.15...v0.4.16) (2024-05-23)
|
||||
|
||||
### Maintenance Improvements
|
||||
|
||||
- Prettify ([fe3e492](https://github.com/medikoo/memoizee/commit/fe3e4922a7d6b6e2a4f90b40bfeea10638b3b05b))
|
||||
|
||||
### [0.4.15](https://github.com/medikoo/memoizee/compare/v0.4.14...v0.4.15) (2021-01-08)
|
||||
|
||||
_Maintainance update_
|
||||
|
||||
<a name="0.4.14"></a>
|
||||
|
||||
## [0.4.14](https://github.com/medikoo/memoizee/compare/v0.4.13...v0.4.14) (2018-08-13)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- ensure to not force unhandled rejections ([9b416ea](https://github.com/medikoo/memoizee/commit/9b416ea))
|
||||
|
||||
<a name="0.4.13"></a>
|
||||
|
||||
## [0.4.13](https://github.com/medikoo/memoizee/compare/v0.4.12...v0.4.13) (2018-08-06)
|
||||
|
||||
### Features
|
||||
|
||||
- **promise:** support cancellation case ([b4b018d](https://github.com/medikoo/memoizee/commit/b4b018d)), closes [#97](https://github.com/medikoo/memoizee/issues/97)
|
||||
|
||||
<a name="0.4.12"></a>
|
||||
|
||||
## [0.4.12](https://github.com/medikoo/memoizee/compare/v0.4.11...v0.4.12) (2018-02-23)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- **max-age:** unref timeouts to not block processes from exiting ([5bcc5a4](https://github.com/medikoo/memoizee/commit/5bcc5a4)), closes [#25](https://github.com/medikoo/memoizee/issues/25)
|
||||
|
||||
<a name="0.4.11"></a>
|
||||
|
||||
## [0.4.11](https://github.com/medikoo/memoizee/compare/v0.4.10...v0.4.11) (2017-09-11)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- \_get and \_has internal args handling. ([7cb1c7a](https://github.com/medikoo/memoizee/commit/7cb1c7a)), closes [#88](https://github.com/medikoo/memoizee/issues/88)
|
||||
|
||||
<a name="0.4.10"></a>
|
||||
|
||||
## [0.4.10](https://github.com/medikoo/memoizee/compare/v0.4.9...v0.4.10) (2017-09-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- remove then:finally mode as it can't work right ([5b79698](https://github.com/medikoo/memoizee/commit/5b79698))
|
||||
|
||||
<a name="0.4.9"></a>
|
||||
|
||||
## [0.4.9](https://github.com/medikoo/memoizee/compare/v0.4.8...v0.4.9) (2017-08-29)
|
||||
|
||||
<a name="0.4.8"></a>
|
||||
|
||||
## [0.4.8](https://github.com/medikoo/memoizee/compare/v0.4.7...v0.4.8) (2017-08-29)
|
||||
|
||||
<a name="0.4.7"></a>
|
||||
|
||||
## [0.4.7](https://github.com/medikoo/memoizee/compare/v0.4.6...v0.4.7) (2017-08-29)
|
||||
|
||||
### Features
|
||||
|
||||
- improve 'promise' mode handling ([759e315](https://github.com/medikoo/memoizee/commit/759e315))
|
||||
- improve internal promise validation ([d23b94f](https://github.com/medikoo/memoizee/commit/d23b94f))
|
||||
|
||||
<a name="0.4.6"></a>
|
||||
|
||||
## [0.4.6](https://github.com/medikoo/memoizee/compare/v0.4.5...v0.4.6) (2017-08-24)
|
||||
|
||||
- `profileName` option for naming memoizee instances in profile output
|
||||
|
||||
<a name="0.4.5"></a>
|
||||
|
||||
## [0.4.5](https://github.com/medikoo/memoizee/compare/v0.4.4...v0.4.5) (2017-05-10)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- resolution of extensions with weak handling ([f29a97b](https://github.com/medikoo/memoizee/commit/f29a97b)), closes [#79](https://github.com/medikoo/memoizee/issues/79)
|
||||
|
||||
## Old changelog
|
||||
|
||||
See `CHANGES`
|
||||
124
node_modules/memoizee/CHANGES
generated
vendored
Normal file
124
node_modules/memoizee/CHANGES
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
-- For new changelog see CHANGELOG.md
|
||||
|
||||
v0.4.4 -- 2017.03.15
|
||||
* Expose _get and _has methods. It provides temporary means for better cache inspection until
|
||||
v1 is delivered
|
||||
|
||||
v0.4.3 -- 2017.02.20
|
||||
* Fix normalization resolver, so it validates already normalized resolvers (reported at #70)
|
||||
|
||||
v0.4.2 -- 2017.02.17
|
||||
* Guard proper promise resolution in promise mode
|
||||
* Improve documentation
|
||||
* Improve npm scripts configuration
|
||||
* Improve CI configuration
|
||||
|
||||
v0.4.1 -- 2016.07.13
|
||||
* Fix promise mode to not use `then` and `finally` pair. Thanks @Kovensky
|
||||
* Add 'done' mode to 'promise' mode (so now callbacks can be registered through `done` but no
|
||||
`finally` event if it's implemented)
|
||||
|
||||
v0.4.0 -- 2016.07.07
|
||||
* Introduce 'promise' mode
|
||||
* Change signature of internal events for 'async' case
|
||||
* Document 'normalizer' option
|
||||
|
||||
v0.3.10 -- 2016.04.21
|
||||
* Fix resolvers bug (#12)
|
||||
* Fix arguments support for weak mode
|
||||
* Update repository address after rename
|
||||
|
||||
v0.3.9 -- 2015.08.04
|
||||
* Update dependencies
|
||||
* Improve documentation
|
||||
* FIx spelling of LICENSE
|
||||
|
||||
v0.3.8 -- 2014.10.08
|
||||
* Introduce WeakMap based `weak` mode
|
||||
|
||||
v0.3.7 -- 2014.08.14
|
||||
* Fix prefetch support for asynchronous functions (#19)
|
||||
* Configure lint scripts
|
||||
|
||||
v0.3.6 -- 2014.07.28
|
||||
* Fix race condition issue related to clear/delete calls and returning id's (#18)
|
||||
* Fix maxAge major cache handling issue (on timeout instead of individual record whole cache was
|
||||
cleared)
|
||||
|
||||
v0.3.5 -- 2014.07.07
|
||||
* Fix internal id genaration, for primitive, length = 1 case.
|
||||
Ids were not serialized to strings, and that caused issues with other
|
||||
internal logiv, which e.g. treated `null` case specifically.
|
||||
Fixes #15 (Thanks @isaacg for reporting)
|
||||
|
||||
v0.3.4 -- 2014.06.22
|
||||
* Fix async handling in case of clear between two async calls
|
||||
(assurance of unique cache ids solves that). Fixes #13
|
||||
|
||||
v0.3.3 -- 2014.05.12
|
||||
* Fix profiler special property definition
|
||||
|
||||
v0.3.2 -- 2014.05.01
|
||||
* Provide no-arguments memoization out of a box
|
||||
(no need to provide normalizer to `memoizee/plain`)
|
||||
|
||||
v0.3.1 -- 2014.04.27
|
||||
* Update package.json to use latest 'tad' engine (fixes tests evaluation)
|
||||
|
||||
v0.3.0 -- 2014.04.27
|
||||
Major reorganization and partial refactoring
|
||||
* Move out main modules from lib folder
|
||||
* Introduce normalizer based memoization. Primitive and regular handlers were converted into
|
||||
dedicated normalizers (located in lib/normalizers folder). Custom normalizers can be provided at
|
||||
run time via `normalizer` option.
|
||||
* Provide 'plain' module which does not import (require) any extensions or normalizers. Thanks to
|
||||
that it's lighter for e.g. client-side bundle. Any extensions that are expected to be used should
|
||||
be required upfront, normalizers should be provided via `normalizer` option.
|
||||
* Rename `memoized.clear` into `memoized.delete`, and `memoized.clearAll` into `memoized.clear`
|
||||
* Rename `memoized.clearRef` into `memoized.deleteRef` (applies to 'refCounter' option)
|
||||
* Remove 'method' option. Instead 'methods' and 'methods-plan' modules are provided which generate
|
||||
descriptors for lazy created memoized methods.
|
||||
* 'profile' is no longer an extension. It's provided as dedicated module.
|
||||
* Clean up logic for `async` handling
|
||||
* Take out 'max' extension's LRU logic into external `lru-queue` package.
|
||||
See https://github.com/medikoo/lru-queue
|
||||
* Remove possibility to access original arguments when resolvers are used
|
||||
* Assure expected length of memoized functions
|
||||
* Remove Makefile (it's environment agnostic package)
|
||||
|
||||
v0.2.6 -- 2013.10.08
|
||||
* Fix internal events propagation when handling async calls that
|
||||
resolve with errors. `asyncpurge` was emitted for values that had no
|
||||
`asyncinit` emitted. Issue #9
|
||||
|
||||
v0.2.5 -- 2013.06.21
|
||||
* Fix primitive handling for dynamic arguments length
|
||||
|
||||
v0.2.4 -- 2013.03.23
|
||||
* Throw on circular invocations, they cannot be memoized as intended.
|
||||
|
||||
v0.2.3 -- 2012.10.04
|
||||
* Fixed serious bug related to not properly cleared cache when working in
|
||||
regular mode
|
||||
|
||||
v0.2.2 -- 2012.10.03
|
||||
* preFetch functionality for maxAge variant
|
||||
* Prevent memoization of already memoized functions
|
||||
|
||||
v0.2.1 -- 2012.09.21
|
||||
* Fix missing global reference in method option logic
|
||||
* Fix variable visibility in async option logic
|
||||
* Lint cleanup
|
||||
|
||||
v0.2.0 -- 2012.09.21
|
||||
* Modularization and general algorithm cleanup
|
||||
* Cache is limited (max option) using LRU instead of FIFO algorithm
|
||||
* Improved async mode, and its handling by other options
|
||||
|
||||
v0.1.1 -- 2012.09.19
|
||||
* Fix dispose invocations for no arguments call
|
||||
* Small documentation improvements
|
||||
|
||||
v0.1.0 -- 2012.09.18
|
||||
* Initial. Derived from es5-ext package and added `async`, `maxAge`,
|
||||
`refCounter`, `max` and `dispose` options.
|
||||
2
node_modules/memoizee/LICENSE
generated
vendored
2
node_modules/memoizee/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2012-2018, Mariusz Nowak, @medikoo, medikoo.com
|
||||
Copyright (c) 2012-2024, Mariusz Nowak, @medikoo, medikoo.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
|
||||
233
node_modules/memoizee/README.md
generated
vendored
233
node_modules/memoizee/README.md
generated
vendored
@@ -1,6 +1,5 @@
|
||||
[![*nix build status][nix-build-image]][nix-build-url]
|
||||
[![Windows build status][win-build-image]][win-build-url]
|
||||
![Transpilation status][transpilation-image]
|
||||
[![Build status][build-image]][build-url]
|
||||
[![Tests coverage][cov-image]][cov-url]
|
||||
[![npm version][npm-image]][npm-url]
|
||||
|
||||
# Memoizee
|
||||
@@ -13,25 +12,29 @@ Memoization is best technique to save on memory or CPU cycles when we deal with
|
||||
|
||||
### Features
|
||||
|
||||
* Works with any type of function arguments – **no serialization is needed**
|
||||
* Works with [**any length of function arguments**](#arguments-length). Length can be set as fixed or dynamic.
|
||||
* One of the [**fastest**](#benchmarks) available solutions.
|
||||
* Support for [**promises**](#promise-returning-functions) and [**asynchronous functions**](#nodejs-callback-style-functions)
|
||||
* [**Primitive mode**](#primitive-mode) which assures fast performance when arguments are convertible to strings.
|
||||
* [**WeakMap based mode**](#weakmap-based-configurations) for garbage collection friendly configuration
|
||||
* Can be configured [**for methods**](#memoizing-methods) (when `this` counts in)
|
||||
* Cache [**can be cleared manually**](#manual-clean-up) or [**after specified timeout**](#expire-cache-after-given-period-of-time)
|
||||
* Cache size can be **[limited on LRU basis](#limiting-cache-size)**
|
||||
* Optionally [**accepts resolvers**](#argument-resolvers) that normalize function arguments before passing them to underlying function.
|
||||
* Optional [**reference counter mode**](#reference-counter), that allows more sophisticated cache management
|
||||
* [**Profile tool**](#profiling--statistics) that provides valuable usage statistics
|
||||
* Covered by [**over 500 unit tests**](#tests)
|
||||
- Works with any type of function arguments – **no serialization is needed**
|
||||
- Works with [**any length of function arguments**](#arguments-length). Length can be set as fixed or dynamic.
|
||||
- One of the [**fastest**](#benchmarks) available solutions.
|
||||
- Support for [**promises**](#promise-returning-functions) and [**asynchronous functions**](#nodejs-callback-style-functions)
|
||||
- [**Primitive mode**](#primitive-mode) which assures fast performance when arguments are convertible to strings.
|
||||
- [**WeakMap based mode**](#weakmap-based-configurations) for garbage collection friendly configuration
|
||||
- Can be configured [**for methods**](#memoizing-methods) (when `this` counts in)
|
||||
- Cache [**can be cleared manually**](#manual-clean-up) or [**after specified timeout**](#expire-cache-after-given-period-of-time)
|
||||
- Cache size can be **[limited on LRU basis](#limiting-cache-size)**
|
||||
- Optionally [**accepts resolvers**](#argument-resolvers) that normalize function arguments before passing them to underlying function.
|
||||
- Optional [**reference counter mode**](#reference-counter), that allows more sophisticated cache management
|
||||
- [**Profile tool**](#profiling--statistics) that provides valuable usage statistics
|
||||
- Covered by [**over 500 unit tests**](#tests)
|
||||
|
||||
### Installation
|
||||
|
||||
In your project path — **note the two `e`'s in `memoizee`:**
|
||||
|
||||
$ npm install memoizee
|
||||
```shell
|
||||
$ npm install memoizee
|
||||
# or with yarn
|
||||
$ yarn add memoizee
|
||||
```
|
||||
|
||||
_`memoize` name was already taken, therefore project is published as `memoizee` on NPM._
|
||||
|
||||
@@ -42,9 +45,7 @@ To port it to Browser or any other (non CJS) environment, use your favorite CJS
|
||||
```javascript
|
||||
var memoize = require("memoizee");
|
||||
|
||||
var fn = function(one, two, three) {
|
||||
/* ... */
|
||||
};
|
||||
var fn = function (one, two, three) { /* ... */ };
|
||||
|
||||
memoized = memoize(fn);
|
||||
|
||||
@@ -52,7 +53,7 @@ memoized("foo", 3, "bar");
|
||||
memoized("foo", 3, "bar"); // Cache hit
|
||||
```
|
||||
|
||||
__Note__: Invocations that throw exceptions are not cached.
|
||||
**Note**: Invocations that throw exceptions are not cached.
|
||||
|
||||
### Configuration
|
||||
|
||||
@@ -72,7 +73,7 @@ memoized("foo", 3, {}); // Third argument is ignored (but passed to underlying f
|
||||
memoized("foo", 3, 13); // Cache hit
|
||||
```
|
||||
|
||||
__Note:__ [Parameters predefined with default values (ES2015+ feature)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters) are not reflected in function's `length`, therefore if you want to memoize them as well, you need to tweak `length` setting accordingly
|
||||
**Note:** [Parameters predefined with default values (ES2015+ feature)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters) are not reflected in function's `length`, therefore if you want to memoize them as well, you need to tweak `length` setting accordingly
|
||||
|
||||
Dynamic _length_ behavior can be forced by setting _length_ to `false`, that means memoize will work with any number of arguments.
|
||||
|
||||
@@ -104,33 +105,63 @@ memoized("/path/one"); // Cache hit
|
||||
|
||||
By default cache id for given call is resolved either by:
|
||||
|
||||
* Direct Comparison of values passed in arguments as they are. In such case two different objects, even if their characteristics is exactly same (e.g. `var a = { foo: 'bar' }, b = { foo: 'bar' }`) will be treated as two different values.
|
||||
* Comparison of stringified values of given arguments (`primitive` mode), which serves well, when arguments are expected to be primitive values, or objects that stringify naturally do unique values (e.g. arrays)
|
||||
- Direct Comparison of values passed in arguments as they are. In such case two different objects, even if their characteristics is exactly same (e.g. `var a = { foo: 'bar' }, b = { foo: 'bar' }`) will be treated as two different values.
|
||||
- Comparison of stringified values of given arguments (`primitive` mode), which serves well, when arguments are expected to be primitive values, or objects that stringify naturally do unique values (e.g. arrays)
|
||||
|
||||
Still above two methods do not serve all cases, e.g. if we want to memoize function where arguments are hash objects which we do not want to compare by instance but by its content.
|
||||
|
||||
##### Writing custom cache id normalizers
|
||||
|
||||
There's a `normalizer` option through which we can pass custom cache id normalization function
|
||||
e.g. if we want to memoize a function where argument is a hash object which we do not want to compare by instance but by its content, then we can achieve it as following:
|
||||
There's a `normalizer` option through which we can pass custom cache id normalization function.
|
||||
|
||||
###### Memoizing on dictionary (object hash) arguments)
|
||||
|
||||
if we want to memoize a function where argument is a hash object which we do not want to compare by instance but by its content, then we can achieve it as following:
|
||||
|
||||
```javascript
|
||||
var mfn = memoize(
|
||||
function(hash) {
|
||||
// body of memoized function
|
||||
},
|
||||
{
|
||||
normalizer: function(args) {
|
||||
// args is arguments object as accessible in memoized function
|
||||
return JSON.stringify(args[0]);
|
||||
}
|
||||
}
|
||||
function (hash) {
|
||||
// body of memoized function
|
||||
},
|
||||
{
|
||||
normalizer: function (args) {
|
||||
// args is arguments object as accessible in memoized function
|
||||
return JSON.stringify(args[0]);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
mfn({ foo: "bar" });
|
||||
mfn({ foo: "bar" }); // Cache hit
|
||||
```
|
||||
|
||||
If additionally we want to ensure that our logic works well with different order of properties, we need to imply an additional sorting, e.g.
|
||||
|
||||
```javascript
|
||||
const deepSortedEntries = object =>
|
||||
Object.entries(object)
|
||||
.map(([key, value]) => {
|
||||
if (value && typeof value === "object") return [key, deepSortedEntries(value)];
|
||||
return [key, value];
|
||||
})
|
||||
.sort();
|
||||
|
||||
var mfn = memoize(
|
||||
function (hash) {
|
||||
// body of memoized function
|
||||
},
|
||||
{
|
||||
normalizer: function (args) {
|
||||
// args is arguments object as accessible in memoized function
|
||||
return JSON.stringify(deepSortedEntries(args[0]));
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
mfn({ foo: "bar", bar: "foo" });
|
||||
mfn({ bar: "foo", foo: "bar" }); // Cache hit
|
||||
```
|
||||
|
||||
#### Argument resolvers
|
||||
|
||||
When we're expecting arguments of certain type it's good to coerce them before doing memoization. We can do that by passing additional resolvers array:
|
||||
@@ -140,14 +171,7 @@ memoized = memoize(fn, { length: 2, resolvers: [String, Boolean] });
|
||||
|
||||
memoized(12, [1, 2, 3].length);
|
||||
memoized("12", true); // Cache hit
|
||||
memoized(
|
||||
{
|
||||
toString: function() {
|
||||
return "12";
|
||||
}
|
||||
},
|
||||
{}
|
||||
); // Cache hit
|
||||
memoized({ toString: function () { return "12"; } }, {}); // Cache hit
|
||||
```
|
||||
|
||||
**Note. If your arguments are collections (arrays or hashes) that you want to memoize by content (not by self objects), you need to cast them to strings**, for it's best to just use [primitive mode](#primitive-mode). Arrays have standard string representation and work with primitive mode out of a box, for hashes you need to define `toString` method, that will produce unique string descriptions, or rely on `JSON.stringify`.
|
||||
@@ -164,10 +188,8 @@ The difference from natural behavior is that in case when promise was rejected w
|
||||
the result is immediately removed from memoize cache, and not kept as further reusable result.
|
||||
|
||||
```javascript
|
||||
var afn = function(a, b) {
|
||||
return new Promise(function(res) {
|
||||
res(a + b);
|
||||
});
|
||||
var afn = function (a, b) {
|
||||
return new Promise(function (res) { res(a + b); });
|
||||
};
|
||||
memoized = memoize(afn, { promise: true });
|
||||
|
||||
@@ -186,13 +208,13 @@ memoized = memoize(afn, { promise: "done:finally" });
|
||||
|
||||
Supported modes
|
||||
|
||||
* `then` _(default)_. Values are resolved purely by passing callbacks to `promise.then`. **Side effect is that eventual unhandled rejection on given promise
|
||||
come with no logged warning!**, and that to avoid implied error swallowing both states are resolved tick after callbacks were invoked
|
||||
- `then` _(default)_. Values are resolved purely by passing callbacks to `promise.then`. **Side effect is that eventual unhandled rejection on given promise
|
||||
come with no logged warning!**, and that to avoid implied error swallowing both states are resolved tick after callbacks were invoked
|
||||
|
||||
* `done` Values are resolved purely by passing callback to `done` method. **Side effect is that eventual unhandled rejection on given promise come with no logged warning!**.
|
||||
- `done` Values are resolved purely by passing callback to `done` method. **Side effect is that eventual unhandled rejection on given promise come with no logged warning!**.
|
||||
|
||||
* `done:finally` The only method that may work with no side-effects assuming that promise implementaion does not throw unconditionally
|
||||
if no _onFailure_ callback was passed to `done`, and promise error was handled by other consumer (this is not commonly implemented _done_ behavior). Otherwise side-effect is that exception is thrown on promise rejection (highly not recommended)
|
||||
- `done:finally` The only method that may work with no side-effects assuming that promise implementaion does not throw unconditionally
|
||||
if no _onFailure_ callback was passed to `done`, and promise error was handled by other consumer (this is not commonly implemented _done_ behavior). Otherwise side-effect is that exception is thrown on promise rejection (highly not recommended)
|
||||
|
||||
##### Node.js callback style functions
|
||||
|
||||
@@ -200,21 +222,19 @@ With _async_ option we indicate that we memoize asynchronous (Node.js style) fun
|
||||
Operations that result with an error are not cached.
|
||||
|
||||
```javascript
|
||||
afn = function(a, b, cb) {
|
||||
setTimeout(function() {
|
||||
cb(null, a + b);
|
||||
}, 200);
|
||||
afn = function (a, b, cb) {
|
||||
setTimeout(function () { cb(null, a + b); }, 200);
|
||||
};
|
||||
memoized = memoize(afn, { async: true });
|
||||
|
||||
memoized(3, 7, function(err, res) {
|
||||
memoized(3, 7, function(err, res) {
|
||||
// Cache hit
|
||||
});
|
||||
memoized(3, 7, function (err, res) {
|
||||
memoized(3, 7, function (err, res) {
|
||||
// Cache hit
|
||||
});
|
||||
});
|
||||
|
||||
memoized(3, 7, function(err, res) {
|
||||
// Cache hit
|
||||
memoized(3, 7, function (err, res) {
|
||||
// Cache hit
|
||||
});
|
||||
```
|
||||
|
||||
@@ -223,12 +243,12 @@ memoized(3, 7, function(err, res) {
|
||||
When we are defining a prototype, we may want to define a method that will memoize it's results in relation to each instance. A basic way to obtain that would be:
|
||||
|
||||
```javascript
|
||||
var Foo = function() {
|
||||
this.bar = memoize(this.bar.bind(this), { someOption: true });
|
||||
// ... constructor logic
|
||||
var Foo = function () {
|
||||
this.bar = memoize(this.bar.bind(this), { someOption: true });
|
||||
// ... constructor logic
|
||||
};
|
||||
Foo.prototype.bar = function() {
|
||||
// ... method logic
|
||||
Foo.prototype.bar = function () {
|
||||
// ... method logic
|
||||
};
|
||||
```
|
||||
|
||||
@@ -238,19 +258,19 @@ There's a lazy methods descriptor generator provided:
|
||||
var d = require("d");
|
||||
var memoizeMethods = require("memoizee/methods");
|
||||
|
||||
var Foo = function() {
|
||||
// ... constructor logic
|
||||
var Foo = function () {
|
||||
// ... constructor logic
|
||||
};
|
||||
Object.defineProperties(
|
||||
Foo.prototype,
|
||||
memoizeMethods({
|
||||
bar: d(
|
||||
function() {
|
||||
// ... method logic
|
||||
},
|
||||
{ someOption: true }
|
||||
)
|
||||
})
|
||||
Foo.prototype,
|
||||
memoizeMethods({
|
||||
bar: d(
|
||||
function () {
|
||||
// ... method logic
|
||||
},
|
||||
{ someOption: true }
|
||||
),
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
@@ -264,9 +284,7 @@ It can be combined with other options mentioned across documentation. However du
|
||||
```javascript
|
||||
var memoize = require("memoizee/weak");
|
||||
|
||||
var memoized = memoize(function(obj) {
|
||||
return Object.keys(obj);
|
||||
});
|
||||
var memoized = memoize(function (obj) { return Object.keys(obj); });
|
||||
|
||||
var obj = { foo: true, bar: false };
|
||||
memoized(obj);
|
||||
@@ -300,9 +318,9 @@ memoized = memoize(fn, { maxAge: 1000 }); // 1 second
|
||||
|
||||
memoized("foo", 3);
|
||||
memoized("foo", 3); // Cache hit
|
||||
setTimeout(function() {
|
||||
memoized("foo", 3); // No longer in cache, re-executed
|
||||
memoized("foo", 3); // Cache hit
|
||||
setTimeout(function () {
|
||||
memoized("foo", 3); // No longer in cache, re-executed
|
||||
memoized("foo", 3); // Cache hit
|
||||
}, 2000);
|
||||
```
|
||||
|
||||
@@ -314,16 +332,16 @@ memoized = memoize(fn, { maxAge: 1000, preFetch: true }); // Defaults to 0.33
|
||||
memoized("foo", 3);
|
||||
memoized("foo", 3); // Cache hit
|
||||
|
||||
setTimeout(function() {
|
||||
memoized("foo", 3); // Cache hit
|
||||
setTimeout(function () {
|
||||
memoized("foo", 3); // Cache hit
|
||||
}, 500);
|
||||
|
||||
setTimeout(function() {
|
||||
memoized("foo", 3); // Cache hit, silently pre-fetched in next tick
|
||||
setTimeout(function () {
|
||||
memoized("foo", 3); // Cache hit, silently pre-fetched in next tick
|
||||
}, 800);
|
||||
|
||||
setTimeout(function() {
|
||||
memoized("foo", 3); // Cache hit
|
||||
setTimeout(function () {
|
||||
memoized("foo", 3); // Cache hit
|
||||
}, 1300);
|
||||
```
|
||||
|
||||
@@ -335,12 +353,12 @@ memoized = memoize(fn, { maxAge: 1000, preFetch: 0.6 });
|
||||
memoized("foo", 3);
|
||||
memoized("foo", 3); // Cache hit
|
||||
|
||||
setTimeout(function() {
|
||||
memoized("foo", 3); // Cache hit, silently pre-fetched in next tick
|
||||
setTimeout(function () {
|
||||
memoized("foo", 3); // Cache hit, silently pre-fetched in next tick
|
||||
}, 500);
|
||||
|
||||
setTimeout(function() {
|
||||
memoized("foo", 3); // Cache hit
|
||||
setTimeout(function () {
|
||||
memoized("foo", 3); // Cache hit
|
||||
}, 1300);
|
||||
```
|
||||
|
||||
@@ -388,11 +406,7 @@ memoized("bar", 7); // Re-executed, Cache cleared for 'lorem', 11
|
||||
You can register a callback to be called on each value removed from the cache:
|
||||
|
||||
```javascript
|
||||
memoized = memoize(fn, {
|
||||
dispose: function(value) {
|
||||
/*…*/
|
||||
}
|
||||
});
|
||||
memoized = memoize(fn, { dispose: function (value) { /*…*/ } });
|
||||
|
||||
var foo3 = memoized("foo", 3);
|
||||
var bar7 = memoized("bar", 7);
|
||||
@@ -460,10 +474,10 @@ Memoize statistics:
|
||||
------------------------------------------------------------
|
||||
```
|
||||
|
||||
* _Init_ – Initial hits
|
||||
* _Cache_ – Cache hits
|
||||
* _%Cache_ – What's the percentage of cache hits (of all function calls)
|
||||
* _Source location_ – Where in the source code given memoization was initialized
|
||||
- _Init_ – Initial hits
|
||||
- _Cache_ – Cache hits
|
||||
- _%Cache_ – What's the percentage of cache hits (of all function calls)
|
||||
- _Source location_ – Where in the source code given memoization was initialized
|
||||
|
||||
### Tests
|
||||
|
||||
@@ -491,13 +505,12 @@ To report a security vulnerability, please use the [Tidelift security contact](h
|
||||
|
||||
### Contributors
|
||||
|
||||
* [@puzrin](https://github.com/puzrin) (Vitaly Puzrin)
|
||||
* Proposal and help with coining right _pre-fetch_ logic for [_maxAge_](https://github.com/medikoo/memoize#expire-cache-after-given-period-of-time) variant
|
||||
- [@puzrin](https://github.com/puzrin) (Vitaly Puzrin)
|
||||
- Proposal and help with coining right _pre-fetch_ logic for [_maxAge_](https://github.com/medikoo/memoize#expire-cache-after-given-period-of-time) variant
|
||||
|
||||
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/memoizee/branches/master/shields_badge.svg
|
||||
[nix-build-url]: https://semaphoreci.com/medikoo-org/memoizee
|
||||
[win-build-image]: https://ci.appveyor.com/api/projects/status/hsxubnbwe89c26bu?svg=true
|
||||
[win-build-url]: https://ci.appveyor.com/project/medikoo/memoizee
|
||||
[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg
|
||||
[build-image]: https://github.com/medikoo/memoizee/workflows/Integrate/badge.svg
|
||||
[build-url]: https://github.com/medikoo/memoizee/actions?query=workflow%3AIntegrate
|
||||
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/memoizee.svg
|
||||
[cov-url]: https://codecov.io/gh/medikoo/memoizee
|
||||
[npm-image]: https://img.shields.io/npm/v/memoizee.svg
|
||||
[npm-url]: https://www.npmjs.com/package/memoizee
|
||||
|
||||
22
node_modules/memoizee/commitlint.config.js
generated
vendored
Normal file
22
node_modules/memoizee/commitlint.config.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"body-leading-blank": [2, "always"],
|
||||
"body-max-line-length": [2, "always", 72],
|
||||
"footer-leading-blank": [2, "always"],
|
||||
"footer-max-line-length": [2, "always", 72],
|
||||
"header-max-length": [2, "always", 72],
|
||||
"scope-case": [2, "always", "start-case"],
|
||||
"scope-enum": [2, "always", [""]],
|
||||
"subject-case": [2, "always", "sentence-case"],
|
||||
"subject-empty": [2, "never"],
|
||||
"subject-full-stop": [2, "never", "."],
|
||||
"type-case": [2, "always", "lower-case"],
|
||||
"type-empty": [2, "never"],
|
||||
"type-enum": [
|
||||
2, "always",
|
||||
["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "style", "test"],
|
||||
],
|
||||
},
|
||||
};
|
||||
2
node_modules/memoizee/ext/async.js
generated
vendored
2
node_modules/memoizee/ext/async.js
generated
vendored
@@ -28,7 +28,7 @@ require("../lib/registered-extensions").async = function (tbi, conf) {
|
||||
currentCallback = last;
|
||||
args = slice.call(args, 0, -1);
|
||||
}
|
||||
return base.apply(currentContext = this, currentArgs = args);
|
||||
return base.apply((currentContext = this), (currentArgs = args));
|
||||
}, base);
|
||||
try { mixin(conf.memoized, base); }
|
||||
catch (ignore) {}
|
||||
|
||||
22
node_modules/memoizee/ext/dispose.js
generated
vendored
22
node_modules/memoizee/ext/dispose.js
generated
vendored
@@ -5,29 +5,23 @@
|
||||
var callable = require("es5-ext/object/valid-callable")
|
||||
, forEach = require("es5-ext/object/for-each")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
|
||||
, apply = Function.prototype.apply;
|
||||
, apply = Function.prototype.apply;
|
||||
|
||||
extensions.dispose = function (dispose, conf, options) {
|
||||
var del;
|
||||
callable(dispose);
|
||||
if ((options.async && extensions.async) || (options.promise && extensions.promise)) {
|
||||
conf.on("deleteasync", del = function (id, resultArray) {
|
||||
apply.call(dispose, null, resultArray);
|
||||
});
|
||||
conf.on(
|
||||
"deleteasync",
|
||||
(del = function (id, resultArray) { apply.call(dispose, null, resultArray); })
|
||||
);
|
||||
conf.on("clearasync", function (cache) {
|
||||
forEach(cache, function (result, id) {
|
||||
del(id, result);
|
||||
});
|
||||
forEach(cache, function (result, id) { del(id, result); });
|
||||
});
|
||||
return;
|
||||
}
|
||||
conf.on("delete", del = function (id, result) {
|
||||
dispose(result);
|
||||
});
|
||||
conf.on("delete", (del = function (id, result) { dispose(result); }));
|
||||
conf.on("clear", function (cache) {
|
||||
forEach(cache, function (result, id) {
|
||||
del(id, result);
|
||||
});
|
||||
forEach(cache, function (result, id) { del(id, result); });
|
||||
});
|
||||
};
|
||||
|
||||
19
node_modules/memoizee/ext/max.js
generated
vendored
19
node_modules/memoizee/ext/max.js
generated
vendored
@@ -13,14 +13,19 @@ extensions.max = function (max, conf, options) {
|
||||
if (!max) return;
|
||||
|
||||
queue = lruQueue(max);
|
||||
postfix = (options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async" : "";
|
||||
postfix =
|
||||
(options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async"
|
||||
: "";
|
||||
|
||||
conf.on("set" + postfix, hit = function (id) {
|
||||
id = queue.hit(id);
|
||||
if (id === undefined) return;
|
||||
conf.delete(id);
|
||||
});
|
||||
conf.on(
|
||||
"set" + postfix,
|
||||
(hit = function (id) {
|
||||
id = queue.hit(id);
|
||||
if (id === undefined) return;
|
||||
conf.delete(id);
|
||||
})
|
||||
);
|
||||
conf.on("get" + postfix, hit);
|
||||
conf.on("delete" + postfix, queue.delete);
|
||||
conf.on("clear" + postfix, queue.clear);
|
||||
|
||||
32
node_modules/memoizee/ext/ref-counter.js
generated
vendored
32
node_modules/memoizee/ext/ref-counter.js
generated
vendored
@@ -2,30 +2,24 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
var d = require("d")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
|
||||
, create = Object.create, defineProperties = Object.defineProperties;
|
||||
var d = require("d")
|
||||
, extensions = require("../lib/registered-extensions")
|
||||
, create = Object.create
|
||||
, defineProperties = Object.defineProperties;
|
||||
|
||||
extensions.refCounter = function (ignore, conf, options) {
|
||||
var cache, postfix;
|
||||
|
||||
cache = create(null);
|
||||
postfix = (options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async" : "";
|
||||
postfix =
|
||||
(options.async && extensions.async) || (options.promise && extensions.promise)
|
||||
? "async"
|
||||
: "";
|
||||
|
||||
conf.on("set" + postfix, function (id, length) {
|
||||
cache[id] = length || 1;
|
||||
});
|
||||
conf.on("get" + postfix, function (id) {
|
||||
++cache[id];
|
||||
});
|
||||
conf.on("delete" + postfix, function (id) {
|
||||
delete cache[id];
|
||||
});
|
||||
conf.on("clear" + postfix, function () {
|
||||
cache = {};
|
||||
});
|
||||
conf.on("set" + postfix, function (id, length) { cache[id] = length || 1; });
|
||||
conf.on("get" + postfix, function (id) { ++cache[id]; });
|
||||
conf.on("delete" + postfix, function (id) { delete cache[id]; });
|
||||
conf.on("clear" + postfix, function () { cache = {}; });
|
||||
|
||||
defineProperties(conf.memoized, {
|
||||
deleteRef: d(function () {
|
||||
@@ -43,6 +37,6 @@ extensions.refCounter = function (ignore, conf, options) {
|
||||
if (id === null) return 0;
|
||||
if (!cache[id]) return 0;
|
||||
return cache[id];
|
||||
})
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
4
node_modules/memoizee/index.js
generated
vendored
4
node_modules/memoizee/index.js
generated
vendored
@@ -17,8 +17,8 @@ module.exports = function (fn/*, options*/) {
|
||||
options.normalizer = require("./normalizers/get-primitive-fixed")(length);
|
||||
}
|
||||
} else if (length === false) options.normalizer = require("./normalizers/get")();
|
||||
else if (length === 1) options.normalizer = require("./normalizers/get-1")();
|
||||
else options.normalizer = require("./normalizers/get-fixed")(length);
|
||||
else if (length === 1) options.normalizer = require("./normalizers/get-1")();
|
||||
else options.normalizer = require("./normalizers/get-fixed")(length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
node_modules/memoizee/lib/configure-map.js
generated
vendored
4
node_modules/memoizee/lib/configure-map.js
generated
vendored
@@ -136,7 +136,7 @@ module.exports = function (original, length, options) {
|
||||
return on.call(this, type, listener);
|
||||
},
|
||||
emit: emit,
|
||||
updateEnv: function () { original = conf.original; }
|
||||
updateEnv: function () { original = conf.original; },
|
||||
};
|
||||
if (get) {
|
||||
extDel = defineLength(function (arg) {
|
||||
@@ -176,7 +176,7 @@ module.exports = function (original, length, options) {
|
||||
delete: d(extDel),
|
||||
clear: d(conf.clear),
|
||||
_get: d(extGet),
|
||||
_has: d(extHas)
|
||||
_has: d(extHas),
|
||||
});
|
||||
return conf;
|
||||
};
|
||||
|
||||
4
node_modules/memoizee/lib/methods.js
generated
vendored
4
node_modules/memoizee/lib/methods.js
generated
vendored
@@ -16,9 +16,7 @@ module.exports = function (memoize) {
|
||||
options = normalizeOpts(options);
|
||||
if (length === undefined) {
|
||||
length = resolveLength(
|
||||
options.length,
|
||||
fn.length,
|
||||
options.async && extensions.async
|
||||
options.length, fn.length, options.async && extensions.async
|
||||
);
|
||||
}
|
||||
options.normalizer = options.getNormalizer(length);
|
||||
|
||||
10
node_modules/memoizee/lib/resolve-resolve.js
generated
vendored
10
node_modules/memoizee/lib/resolve-resolve.js
generated
vendored
@@ -7,15 +7,13 @@ var toArray = require("es5-ext/array/to-array")
|
||||
var slice = Array.prototype.slice, resolveArgs;
|
||||
|
||||
resolveArgs = function (args) {
|
||||
return this.map(function (resolve, i) {
|
||||
return resolve ? resolve(args[i]) : args[i];
|
||||
}).concat(slice.call(args, this.length));
|
||||
return this.map(function (resolve, i) { return resolve ? resolve(args[i]) : args[i]; }).concat(
|
||||
slice.call(args, this.length)
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = function (resolvers) {
|
||||
resolvers = toArray(resolvers);
|
||||
resolvers.forEach(function (resolve) {
|
||||
if (isValue(resolve)) callable(resolve);
|
||||
});
|
||||
resolvers.forEach(function (resolve) { if (isValue(resolve)) callable(resolve); });
|
||||
return resolveArgs.bind(resolvers);
|
||||
};
|
||||
|
||||
8
node_modules/memoizee/lib/weak.js
generated
vendored
8
node_modules/memoizee/lib/weak.js
generated
vendored
@@ -58,7 +58,7 @@ module.exports = function (memoize) {
|
||||
delete: d(function (obj) {
|
||||
if (resolve) obj = resolve(arguments)[0];
|
||||
return map.delete(obj);
|
||||
})
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ module.exports = function (memoize) {
|
||||
);
|
||||
}
|
||||
}
|
||||
map.set(obj, memoizer = memoize(partial.call(fn, obj), options));
|
||||
map.set(obj, (memoizer = memoize(partial.call(fn, obj), options)));
|
||||
}
|
||||
return memoizer.apply(this, slice.call(args, 1));
|
||||
}, length),
|
||||
@@ -99,7 +99,7 @@ module.exports = function (memoize) {
|
||||
if (!memoizer) return;
|
||||
memoizer.delete.apply(this, slice.call(args, 1));
|
||||
}, length)
|
||||
)
|
||||
),
|
||||
}
|
||||
);
|
||||
if (!options.refCounter) return memoized;
|
||||
@@ -127,7 +127,7 @@ module.exports = function (memoize) {
|
||||
if (!memoizer) return 0;
|
||||
return memoizer.getRefCount.apply(this, slice.call(args, 1));
|
||||
}, length)
|
||||
)
|
||||
),
|
||||
});
|
||||
return memoized;
|
||||
};
|
||||
|
||||
2
node_modules/memoizee/normalizers/get-1.js
generated
vendored
2
node_modules/memoizee/normalizers/get-1.js
generated
vendored
@@ -24,6 +24,6 @@ module.exports = function () {
|
||||
clear: function () {
|
||||
argsMap = [];
|
||||
cache = [];
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
2
node_modules/memoizee/normalizers/get-fixed.js
generated
vendored
2
node_modules/memoizee/normalizers/get-fixed.js
generated
vendored
@@ -66,6 +66,6 @@ module.exports = function (length) {
|
||||
clear: function () {
|
||||
map = [[], []];
|
||||
cache = create(null);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
4
node_modules/memoizee/normalizers/get-primitive-fixed.js
generated
vendored
4
node_modules/memoizee/normalizers/get-primitive-fixed.js
generated
vendored
@@ -2,9 +2,7 @@
|
||||
|
||||
module.exports = function (length) {
|
||||
if (!length) {
|
||||
return function () {
|
||||
return "";
|
||||
};
|
||||
return function () { return ""; };
|
||||
}
|
||||
return function (args) {
|
||||
var id = String(args[0]), i = 0, currentLength = length;
|
||||
|
||||
2
node_modules/memoizee/normalizers/get.js
generated
vendored
2
node_modules/memoizee/normalizers/get.js
generated
vendored
@@ -85,6 +85,6 @@ module.exports = function () {
|
||||
clear: function () {
|
||||
map = [];
|
||||
cache = create(null);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
2
node_modules/memoizee/normalizers/primitive.js
generated
vendored
2
node_modules/memoizee/normalizers/primitive.js
generated
vendored
@@ -3,7 +3,7 @@
|
||||
module.exports = function (args) {
|
||||
var id, i, length = args.length;
|
||||
if (!length) return "\u0002";
|
||||
id = String(args[i = 0]);
|
||||
id = String(args[(i = 0)]);
|
||||
while (--length) id += "\u0001" + args[++i];
|
||||
return id;
|
||||
};
|
||||
|
||||
203
node_modules/memoizee/package.json
generated
vendored
203
node_modules/memoizee/package.json
generated
vendored
@@ -1,93 +1,114 @@
|
||||
{
|
||||
"_from": "memoizee@0.4.X",
|
||||
"_id": "memoizee@0.4.15",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==",
|
||||
"_location": "/memoizee",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "memoizee@0.4.X",
|
||||
"name": "memoizee",
|
||||
"escapedName": "memoizee",
|
||||
"rawSpec": "0.4.X",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.4.X"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/debug-fabulous"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz",
|
||||
"_shasum": "e6f3d2da863f318d02225391829a6c5956555b72",
|
||||
"_spec": "memoizee@0.4.X",
|
||||
"_where": "/var/www/html/jason/WeihnachtenMelly/node_modules/debug-fabulous",
|
||||
"author": {
|
||||
"name": "Mariusz Nowak",
|
||||
"email": "medikoo@medikoo.com",
|
||||
"url": "http://www.medikoo.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/medikoo/memoizee/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"d": "^1.0.1",
|
||||
"es5-ext": "^0.10.53",
|
||||
"es6-weak-map": "^2.0.3",
|
||||
"event-emitter": "^0.3.5",
|
||||
"is-promise": "^2.2.2",
|
||||
"lru-queue": "^0.1.0",
|
||||
"next-tick": "^1.1.0",
|
||||
"timers-ext": "^0.1.7"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Memoize/cache function results",
|
||||
"devDependencies": {
|
||||
"bluebird": "^3.7.2",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-medikoo-es5": "^1.7.3",
|
||||
"plain-promise": "^0.1.1",
|
||||
"tad": "^2.0.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "medikoo-es5",
|
||||
"root": true,
|
||||
"globals": {
|
||||
"setTimeout": true,
|
||||
"clearTimeout": true
|
||||
},
|
||||
"rules": {
|
||||
"max-lines-per-function": "off"
|
||||
}
|
||||
},
|
||||
"homepage": "https://github.com/medikoo/memoizee#readme",
|
||||
"keywords": [
|
||||
"memoize",
|
||||
"memoizer",
|
||||
"cache",
|
||||
"memoization",
|
||||
"memo",
|
||||
"memcached",
|
||||
"hashing.",
|
||||
"storage",
|
||||
"caching",
|
||||
"memory",
|
||||
"gc",
|
||||
"weak",
|
||||
"garbage",
|
||||
"collector",
|
||||
"async"
|
||||
],
|
||||
"license": "ISC",
|
||||
"name": "memoizee",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/medikoo/memoizee.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --ignore-path=.gitignore .",
|
||||
"test": "tad"
|
||||
},
|
||||
"version": "0.4.15"
|
||||
"name": "memoizee",
|
||||
"version": "0.4.17",
|
||||
"description": "Memoize/cache function results",
|
||||
"author": "Mariusz Nowak <medikoo@medikoo.com> (http://www.medikoo.com/)",
|
||||
"keywords": [
|
||||
"memoize",
|
||||
"memoizer",
|
||||
"cache",
|
||||
"memoization",
|
||||
"memo",
|
||||
"memcached",
|
||||
"hashing.",
|
||||
"storage",
|
||||
"caching",
|
||||
"memory",
|
||||
"gc",
|
||||
"weak",
|
||||
"garbage",
|
||||
"collector",
|
||||
"async"
|
||||
],
|
||||
"repository": "medikoo/memoizee",
|
||||
"dependencies": {
|
||||
"d": "^1.0.2",
|
||||
"es5-ext": "^0.10.64",
|
||||
"es6-weak-map": "^2.0.3",
|
||||
"event-emitter": "^0.3.5",
|
||||
"is-promise": "^2.2.2",
|
||||
"lru-queue": "^0.1.0",
|
||||
"next-tick": "^1.1.0",
|
||||
"timers-ext": "^0.1.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bluebird": "^3.7.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-medikoo": "^4.2.0",
|
||||
"git-list-updated": "^1.2.1",
|
||||
"github-release-from-cc-changelog": "^2.3.0",
|
||||
"husky": "^4.3.8",
|
||||
"lint-staged": "^15.2.4",
|
||||
"nyc": "^15.1.0",
|
||||
"plain-promise": "^0.1.1",
|
||||
"prettier-elastic": "^3.2.5",
|
||||
"tad": "^3.1.1"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint"
|
||||
],
|
||||
"*.{css,html,js,json,md,yaml,yml}": [
|
||||
"prettier -c"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "medikoo/es5",
|
||||
"root": true,
|
||||
"globals": {
|
||||
"setTimeout": true,
|
||||
"clearTimeout": true
|
||||
},
|
||||
"rules": {
|
||||
"max-lines-per-function": "off"
|
||||
}
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"exclude": [
|
||||
".github",
|
||||
"coverage/**",
|
||||
"test/**",
|
||||
"*.config.js"
|
||||
],
|
||||
"reporter": [
|
||||
"lcov",
|
||||
"html",
|
||||
"text-summary"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.md",
|
||||
"*.yml"
|
||||
],
|
||||
"options": {
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc npm test",
|
||||
"lint": "eslint --ignore-path=.gitignore .",
|
||||
"lint:updated": "pipe-git-updated --base=main --ext=js -- eslint --ignore-pattern '!*'",
|
||||
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
||||
"prettier-check:updated": "pipe-git-updated --base=main --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
|
||||
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
||||
"prettify:updated": "pipe-git-updated ---base=main -ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write",
|
||||
"test": "tad"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
},
|
||||
"license": "ISC"
|
||||
}
|
||||
|
||||
2
node_modules/memoizee/plain.js
generated
vendored
2
node_modules/memoizee/plain.js
generated
vendored
@@ -6,7 +6,7 @@ var callable = require("es5-ext/object/valid-callable")
|
||||
, configure = require("./lib/configure-map")
|
||||
, resolveLength = require("./lib/resolve-length");
|
||||
|
||||
module.exports = function self(fn /*, options */) {
|
||||
module.exports = function self(fn/*, options */) {
|
||||
var options, length, conf;
|
||||
|
||||
callable(fn);
|
||||
|
||||
22
node_modules/memoizee/profile.js
generated
vendored
22
node_modules/memoizee/profile.js
generated
vendored
@@ -9,23 +9,25 @@ var partial = require("es5-ext/function/#/partial")
|
||||
, d = require("d")
|
||||
, memoize = require("./plain");
|
||||
|
||||
var max = Math.max, stats = exports.statistics = {};
|
||||
var max = Math.max, stats = (exports.statistics = {});
|
||||
|
||||
Object.defineProperty(
|
||||
memoize,
|
||||
"__profiler__",
|
||||
memoize, "__profiler__",
|
||||
d(function (conf) {
|
||||
var id, source, data, stack;
|
||||
stack = new Error().stack;
|
||||
if (
|
||||
!stack ||
|
||||
!stack.split("\n").slice(3).some(function (line) {
|
||||
if (line.indexOf("/memoizee/") === -1 && line.indexOf(" (native)") === -1) {
|
||||
source = line.replace(/\n/g, "\\n").trim();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
!stack
|
||||
.split("\n")
|
||||
.slice(3)
|
||||
.some(function (line) {
|
||||
if (line.indexOf("/memoizee/") === -1 && line.indexOf(" (native)") === -1) {
|
||||
source = line.replace(/\n/g, "\\n").trim();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
) {
|
||||
source = "unknown";
|
||||
}
|
||||
|
||||
6
node_modules/memoizee/tea.yaml
generated
vendored
Normal file
6
node_modules/memoizee/tea.yaml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# https://tea.xyz/what-is-this-file
|
||||
---
|
||||
version: 1.0.0
|
||||
codeOwners:
|
||||
- "0x641A74E8f6b1f59ffadc28b220A316c79a65D87e"
|
||||
quorum: 1
|
||||
Reference in New Issue
Block a user