UNPKG

zan-proxy

Version:
22 lines 671 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const lodash_1 = require("lodash"); const node_localstorage_1 = require("node-localstorage"); const key = 'zanproxy-plugins'; class PluginStorage { constructor(path = __dirname) { this.store = new node_localstorage_1.LocalStorage(path); } set(value) { this.store.setItem(key, JSON.stringify(value)); } get() { let plugins = this.store.getItem(key) || []; if (lodash_1.isString(plugins)) { plugins = JSON.parse(plugins); } return plugins; } } exports.default = PluginStorage; //# sourceMappingURL=storage.js.map