UNPKG

1.08 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var ObjectCache = (function () {
4 function ObjectCache(data) {
5 if (data === void 0) { data = Object.create(null); }
6 this.data = data;
7 }
8 ObjectCache.prototype.toObject = function () {
9 return this.data;
10 };
11 ObjectCache.prototype.get = function (dataId) {
12 return this.data[dataId];
13 };
14 ObjectCache.prototype.set = function (dataId, value) {
15 this.data[dataId] = value;
16 };
17 ObjectCache.prototype.delete = function (dataId) {
18 this.data[dataId] = void 0;
19 };
20 ObjectCache.prototype.clear = function () {
21 this.data = Object.create(null);
22 };
23 ObjectCache.prototype.replace = function (newData) {
24 this.data = newData || Object.create(null);
25 };
26 return ObjectCache;
27}());
28exports.ObjectCache = ObjectCache;
29function defaultNormalizedCacheFactory(seed) {
30 return new ObjectCache(seed);
31}
32exports.defaultNormalizedCacheFactory = defaultNormalizedCacheFactory;
33//# sourceMappingURL=objectCache.js.map
\No newline at end of file