1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | var LocalCache = (function () {
|
8 | function LocalCache() {
|
9 | this.cache = {};
|
10 | }
|
11 | LocalCache.prototype.getItem = function (key) {
|
12 | if (this.cache.hasOwnProperty(key)) {
|
13 | return this.cache[key];
|
14 | }
|
15 | return null;
|
16 | };
|
17 | LocalCache.prototype.setItem = function (key, value) {
|
18 | this.cache[key] = value;
|
19 | };
|
20 | LocalCache.prototype.removeItem = function (key) {
|
21 | delete this.cache[key];
|
22 | };
|
23 | LocalCache.prototype.key = function (n) {
|
24 | return Object.keys(this.cache)[n];
|
25 | };
|
26 | LocalCache.prototype.clear = function () {
|
27 | Object.keys(this.cache).forEach(function (key) {
|
28 | delete this.cache[key];
|
29 | });
|
30 | };
|
31 | Object.defineProperty(LocalCache.prototype, "length", {
|
32 | get: function () {
|
33 | return Object.keys(this.cache).length;
|
34 | },
|
35 | enumerable: true,
|
36 | configurable: true
|
37 | });
|
38 | return LocalCache;
|
39 | }());
|
40 | exports.LocalCache = LocalCache;
|
41 |
|
\ | No newline at end of file |