From 93a9805da73595234cdf0a0d4fc269697c0e22a3 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 21 Jun 2012 13:47:52 +0200 Subject: [PATCH] minor cleanup --- source/Ox/js/Function.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/Ox/js/Function.js b/source/Ox/js/Function.js index 8b3a82c1..782b4e17 100644 --- a/source/Ox/js/Function.js +++ b/source/Ox/js/Function.js @@ -10,6 +10,7 @@ Ox.cache Memoize a function > Ox.test.fn(10) == Ox.test.fn.clear()(10); false @*/ +// TODO: add async test Ox.cache = function(fn, options) { options = Ox.extend({ async: false, @@ -17,9 +18,7 @@ Ox.cache = function(fn, options) { }, options || {}) var cache = {}, ret = function() { - var args = Ox.toArray(arguments), - callback, - key = options.key(args); + var args = Ox.toArray(arguments), key = options.key(args); function callback() { // cache all arguments passed to callback cache[key] = Ox.toArray(arguments); @@ -50,7 +49,7 @@ Ox.cache = function(fn, options) { }); } return ret; - } + }; return ret; };