MessagesForMacintosh/JS/node_modules/apollo-cache-inmemory/lib/objectCache.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ObjectCache = (function () {
function ObjectCache(data) {
if (data === void 0) { data = Object.create(null); }
this.data = data;
}
ObjectCache.prototype.toObject = function () {
return this.data;
};
ObjectCache.prototype.get = function (dataId) {
return this.data[dataId];
};
ObjectCache.prototype.set = function (dataId, value) {
this.data[dataId] = value;
};
ObjectCache.prototype.delete = function (dataId) {
this.data[dataId] = void 0;
};
ObjectCache.prototype.clear = function () {
this.data = Object.create(null);
};
ObjectCache.prototype.replace = function (newData) {
this.data = newData || Object.create(null);
};
return ObjectCache;
}());
exports.ObjectCache = ObjectCache;
function defaultNormalizedCacheFactory(seed) {
return new ObjectCache(seed);
}
exports.defaultNormalizedCacheFactory = defaultNormalizedCacheFactory;
//# sourceMappingURL=objectCache.js.map