Comparing version
@@ -401,5 +401,12 @@ function defaultDispose() { } | ||
} | ||
KeyTrie.prototype.lookup = function (tuple) { | ||
KeyTrie.prototype.lookup = function () { | ||
var array = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
array[_i] = arguments[_i]; | ||
} | ||
return this.lookupArray(array); | ||
}; | ||
KeyTrie.prototype.lookupArray = function (array) { | ||
var node = this; | ||
tuple.forEach(function (key) { return node = node.getChildTrie(key); }); | ||
array.forEach(function (key) { return node = node.getChildTrie(key); }); | ||
return node.data || (node.data = Object.create(null)); | ||
@@ -443,3 +450,3 @@ }; | ||
} | ||
return keyTrie.lookup(args); | ||
return keyTrie.lookupArray(args); | ||
} | ||
@@ -446,0 +453,0 @@ function wrap(originalFunction, options) { |
@@ -21,3 +21,3 @@ "use strict"; | ||
} | ||
return keyTrie.lookup(args); | ||
return keyTrie.lookupArray(args); | ||
} | ||
@@ -24,0 +24,0 @@ exports.defaultMakeCacheKey = defaultMakeCacheKey; |
@@ -7,4 +7,5 @@ export declare class KeyTrie<K> { | ||
constructor(weakness: boolean); | ||
lookup<T extends any[]>(tuple: T): K; | ||
lookup<T extends any[]>(...array: T): K; | ||
lookupArray<T extends any[]>(array: T): K; | ||
private getChildTrie; | ||
} |
@@ -9,5 +9,12 @@ "use strict"; | ||
} | ||
KeyTrie.prototype.lookup = function (tuple) { | ||
KeyTrie.prototype.lookup = function () { | ||
var array = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
array[_i] = arguments[_i]; | ||
} | ||
return this.lookupArray(array); | ||
}; | ||
KeyTrie.prototype.lookupArray = function (array) { | ||
var node = this; | ||
tuple.forEach(function (key) { return node = node.getChildTrie(key); }); | ||
array.forEach(function (key) { return node = node.getChildTrie(key); }); | ||
return node.data || (node.data = Object.create(null)); | ||
@@ -14,0 +21,0 @@ }; |
{ | ||
"name": "optimism", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"author": "Ben Newman <ben@benjamn.com>", | ||
@@ -5,0 +5,0 @@ "description": "Composable reactive caching with efficient invalidation.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
91177
0.97%1103
1.38%