Build changes & minor changes to Cache

This commit is contained in:
Amish Shah
2015-12-12 17:05:42 +00:00
parent cd4a70cfb2
commit cb58bc5414
2 changed files with 8 additions and 4 deletions

View File

@@ -3,8 +3,8 @@
export default class Cache extends Array {
constructor(discrim, limit) {
super();
this.discrim = discrim || "id";
this.discrimCache = {};
this["discrim"] = discrim || "id";
this["discrimCache"] = {};
}
get(key, value) {
@@ -51,7 +51,7 @@ export default class Cache extends Array {
if (item) {
var index = this.indexOf(item);
this[index] = data;
this.discrimCache[data[this.discrim]] = data;
this.discrimCache[data[this.discrim]] = this[index];
return this[index];
} else {
return false;