UNPKG

led-canvas-led

Version:

Example LED class to be used by https://github.com/marionebl/led-canvas

52 lines (44 loc) 1.15 kB
"use strict"; var _classProps = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); }; var objectAssign = require("object-assign"); var Store = (function () { var Store = function Store(initial) { if (initial === undefined) initial = {}; this._ = objectAssign({}, initial); }; _classProps(Store, null, { factory: { writable: true, value: function (initial) { return new Store(initial); } }, set: { writable: true, value: function (key, value) { var obj = {}; if (typeof value === "undefined" && typeof key === "object") { obj = key; } else { obj[key] = value; } return this.factory(objectAssign({}, this._, obj)); } }, get: { writable: true, value: function (key) { if (typeof key === "undefined") { return this._; } else { return this._[key]; } } } }); return Store; })(); module.exports = Store;