force option

Force memoization of already memoized function
This commit is contained in:
Mariusz Nowak
2013-05-18 10:11:09 +02:00
parent f57bac383c
commit 434b866ec3

View File

@@ -13,10 +13,11 @@ module.exports = exports = function (core) {
var options, length, get, clear, conf;
callable(fn);
// Do not memoize already memoized function
if (fn.memoized) return fn;
options = Object(arguments[1]);
// Do not memoize already memoized function
if (fn.memoized && !options.force) return fn;
if (ext.method && (options.method != null)) {
return ext.method(options.method, options, fn, self);
}