UNPKG

skypager-project

Version:
214 lines (173 loc) 5.54 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmory imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmory exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 129); /******/ }) /************************************************************************/ /******/ ({ /***/ "./src/cache.js": /***/ function(module, exports, __webpack_require__) { "use strict"; 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Cache = undefined; var _defineProperty = __webpack_require__(22); var _defineProperty2 = _interopRequireDefault(_defineProperty); var _map = __webpack_require__(67); var _map2 = _interopRequireDefault(_map); var _classCallCheck2 = __webpack_require__(2); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _createClass2 = __webpack_require__(3); var _createClass3 = _interopRequireDefault(_createClass2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var Cache = exports.Cache = function () { function Cache(init) { var _this = this; (0, _classCallCheck3.default)(this, Cache); hide(this, 'hide', function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return hide.apply(undefined, [_this].concat(args)); }); this.clear(init); this.write = function (k, v) { return _this.set(k, v).get(k); }; } (0, _createClass3.default)(Cache, [{ key: 'fetch', value: function fetch(k, defaultValue) { if (this.has(k)) { return this.get(k); } else { this.set(k, typeof defaultValue === 'function' ? defaultValue(k) : defaultValue); return this.get(k); } } }, { key: 'clear', value: function clear(init) { delete this._wm; this._wm = new _map2.default(init); } }, { key: 'delete', value: function _delete(k) { return this._wm.delete(k); } }, { key: 'get', value: function get(k) { return this._wm.get(k); } }, { key: 'has', value: function has(k) { return this._wm.has(k); } }, { key: 'set', value: function set(k, v) { this._wm.set(k, v); return this; } }]); return Cache; }(); exports.default = Cache; function hide(target, propName, value) { var configurable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; (0, _defineProperty2.default)(target, propName, { enumerable: false, configurable: configurable, value: value }); return target; } /***/ }, /***/ 129: /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__("./src/cache.js"); /***/ }, /***/ 2: /***/ function(module, exports) { module.exports = require("babel-runtime/helpers/classCallCheck"); /***/ }, /***/ 22: /***/ function(module, exports) { module.exports = require("babel-runtime/core-js/object/define-property"); /***/ }, /***/ 3: /***/ function(module, exports) { module.exports = require("babel-runtime/helpers/createClass"); /***/ }, /***/ 67: /***/ function(module, exports) { module.exports = require("babel-runtime/core-js/map"); /***/ } /******/ }); //# sourceMappingURL=cache.js.map