swap the meaning of makeArray and toArray: makeArray, like makeObject, is a helper function for arguments processing (that wraps any non-array in an array), toArray, like in other libraries, is an alias for Array.prototype.slice.call

This commit is contained in:
rolux 2012-05-19 12:40:59 +04:00
commit 5692195509
21 changed files with 88 additions and 88 deletions

View file

@ -16,12 +16,12 @@ Ox.cache = function(fn, options) {
}, options || {})
var cache = {},
ret = function() {
var args = Ox.makeArray(arguments),
var args = Ox.toArray(arguments),
callback,
key = options.key(args);
function callback() {
// cache all arguments passed to callback
cache[key] = Ox.makeArray(arguments);
cache[key] = Ox.toArray(arguments);
// call the original callback
Ox.last(args).apply(this, arguments);
}
@ -44,7 +44,7 @@ Ox.cache = function(fn, options) {
if (arguments.length == 0) {
cache = {};
} else {
Ox.toArray(arguments).forEach(function(key) {
Ox.makeArray(arguments).forEach(function(key) {
delete cache[key];
});
}