Comparing version 0.1.0 to 0.1.1
@@ -171,6 +171,12 @@ 'use strict'; | ||
clear = function (length, args) { | ||
var index = 0, rset = cache, i, path = []; | ||
var index = 0, rset = cache, i, path = [], value; | ||
if (length === 0) { | ||
delete rset[length]; | ||
if (dispose && rset.hasOwnProperty("0")) { | ||
value = rset[0]; | ||
delete rset[0]; | ||
dispose(value); | ||
} else { | ||
delete rset[length]; | ||
} | ||
} else if ((rset = rset[length])) { | ||
@@ -239,3 +245,2 @@ while (index < (length - 1)) { | ||
if (!err) { | ||
value.ready = true; | ||
value.value = arguments; | ||
@@ -385,3 +390,3 @@ if (max) { | ||
} | ||
if (value.ready) { | ||
if (value.value) { | ||
nextTick(function () { | ||
@@ -388,0 +393,0 @@ cb.apply(null, this); |
{ | ||
"name": "memoizee", | ||
"version": "0.1.0", | ||
"description": "Complete memoize solution. Works with any type and length of function arguments", | ||
"version": "0.1.1", | ||
"description": "Complete memoize/cache solution. Works with any type and length of function arguments", | ||
"main": "lib/memoize", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -10,13 +10,13 @@ # Memoize – Complete memoize solution for JavaScript | ||
* Works with any type of function arguments – __no serialization is needed__ | ||
* Works with [__any length of function arguments__](#arguments-length). Length can be fixed or dynamic. | ||
* Works with [__any length of function arguments__](#arguments-length). Length can be set as fixed or dynamic. | ||
* One of the [__fastest__](https://github.com/medikoo/memoize/tree/master/benchmark) available solutions. | ||
* Support for [__asynchronous functions__](#memoizing-asynchronous-functions) | ||
* Optional [__primitive mode__](#primitive-mode) which assures fast performance when arguments are conversible to strings. | ||
* Can be configured for [__methods__](#memoizing-a-method) (when `this` counts in) | ||
* Can be configured [__for methods__](#memoizing-a-method) (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](#limiting-cache-size) | ||
* Optionally [__accepts resolvers__](#resolvers) that normalize function arguments before passing them to underlying function. | ||
* Optional [__reference counter__](#reference-counter) mode, that allows more sophisticated cache managment | ||
* 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-) | ||
* Covered by [__over 500 unit tests__](#tests-) | ||
@@ -163,3 +163,3 @@ ## Usage | ||
#### Cache handling | ||
### Cache handling | ||
@@ -166,0 +166,0 @@ #### Manual clean up: |
@@ -1223,2 +1223,13 @@ 'use strict'; | ||
a.deep(value, [10, 88], "Clear all"); | ||
var x = {}, invoked = false; | ||
mfn = t(function () { return x; }, | ||
{ dispose: function (val) { invoked = val; } }); | ||
mfn.clear(); | ||
a(invoked, false, "No args: Post invalid clear"); | ||
mfn(); | ||
a(invoked, false, "No args: Post cache"); | ||
mfn.clear(); | ||
a(invoked, x, "No args: Pre clear"); | ||
}, | ||
@@ -1225,0 +1236,0 @@ "Ref counter": function (a) { |
Sorry, the diff of this file is not supported yet
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
66993
1795