UNPKG

baseframe-js

Version:

A suite of useful Javascript plugins and functions to help with Front-end Development on websites

27 lines (26 loc) 667 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var storeMap = new WeakMap(); var Store = function Store(storeElem, key, value) { var storeRecord = storeMap.get(storeElem) || storeMap.set(storeElem, {}); var keyExists = Reflect.has(storeRecord, key); if (keyExists) { var valueIsNull = value === null; if (valueIsNull) { delete storeRecord[key]; return null; } if (value) { storeRecord[key] = value; } } else { if (value && value !== null) { storeRecord[key] = value; } } return storeRecord[key]; }; var _default = exports["default"] = Store;