Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

itemsholdr

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itemsholdr - npm Package Compare versions

Comparing version 0.7.9 to 0.7.10

2

dist/ItemsHoldr.js

@@ -1,1 +0,1 @@

define(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e,i){var r;void 0===(r=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStorage=function(){var t={clear:function(){for(var e in t)({}).hasOwnProperty.call(t,e)&&delete t[e]},getItem:function(e){return t[e]},key:function(e){return t.keys[e]},get keys(){return Object.keys(t)},get length(){return t.keys.length},removeItem:function(e){delete t[e]},setItem:function(e,i){t[e]=i}};return t}}.apply(e,[i,e]))||(t.exports=r)},function(t,e,i){var r;void 0===(r=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.proliferate=function(t,i,r){for(var s in i)if(i.hasOwnProperty(s)&&(!r||!t.hasOwnProperty(s))){var o=i[s];"object"==typeof o?(t.hasOwnProperty(s)||(t[s]=new o.constructor),e.proliferate(t[s],o,r)):t[s]=o}return t}}.apply(e,[i,e]))||(t.exports=r)},function(t,e,i){var r,s;r=[i,e,i(0),i(3),i(1)],void 0===(s=function(t,e,i,r,s){"use strict";function o(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),o(i),o(r),o(s)}.apply(e,r))||(t.exports=s)},function(t,e,i){var r,s;r=[i,e,i(0),i(4)],void 0===(s=function(t,e,i,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t){void 0===t&&(t={}),this.settings=t,this.autoSave=!!t.autoSave,this.items={},this.itemKeys=[],this.prefix=t.prefix||"",this.values=this.settings.values||{},t.storage?this.storage=t.storage:"undefined"==typeof localStorage?this.storage=i.createStorage():this.storage=localStorage,this.containerSettings={autoSave:this.autoSave,defaults:this.settings.defaults||{},prefix:this.prefix,storage:this.storage}}return Object.defineProperty(t.prototype,"length",{get:function(){return this.itemKeys.length},enumerable:!0,configurable:!0}),t.prototype.key=function(t){return this.itemKeys[t]},t.prototype.getAutoSave=function(){return this.autoSave},t.prototype.setAutoSave=function(t){this.autoSave=t},t.prototype.addItem=function(t,e){this.items[t]=new r.ItemContainer(this.containerSettings,t,e),this.itemKeys.push(t)},t.prototype.getItem=function(t){return this.checkExistence(t),this.items[t].getValue()},t.prototype.removeItem=function(t){({}).hasOwnProperty.call(this.items,t)&&(this.itemKeys.splice(this.itemKeys.indexOf(t),1),delete this.items[t],this.storage.removeItem(""+this.prefix+t),{}.hasOwnProperty.call(this.values,t)&&this.addItem(t,this.values[t]))},t.prototype.setItem=function(t,e){this.checkExistence(t),this.items[t].setValue(e)},t.prototype.increase=function(t,e){void 0===e&&(e=1),this.checkExistence(t);var i=this.items[t].getValue()+e;this.items[t].setValue(i)},t.prototype.decrease=function(t,e){void 0===e&&(e=1),this.checkExistence(t);var i=this.items[t].getValue()-e;this.items[t].setValue(i)},t.prototype.toggle=function(t){this.checkExistence(t);var e=!this.items[t].getValue();this.items[t].setValue(e)},t.prototype.hasKey=function(t){return{}.hasOwnProperty.call(this.items,t)},t.prototype.exportItems=function(){for(var t={},e=0,i=this.itemKeys;e<i.length;e++){var r=i[e];t[r]=this.items[r].getValue()}return t},t.prototype.clear=function(){for(var t=0,e=this.itemKeys;t<e.length;t++){var i=e[t];this.storage.removeItem(""+this.prefix+i)}for(var i in this.items={},this.itemKeys=[],this.values)({}).hasOwnProperty.call(this.values,i)&&this.addItem(i,this.values[i])},t.prototype.saveItem=function(t){if(!{}.hasOwnProperty.call(this.items,t))throw new Error("Unknown key given to ItemsHoldr: '"+t+"'.");this.items[t].updateStorage(!0)},t.prototype.saveAll=function(){for(var t in this.items)this.items[t].updateStorage(!0)},t.prototype.resetAll=function(){this.items={},this.itemKeys=[]},t.prototype.checkExistence=function(t){({}).hasOwnProperty.call(this.items,t)||this.addItem(t,this.values[t])},t}();e.ItemsHoldr=s}.apply(e,r))||(t.exports=s)},function(t,e,i){var r,s;r=[i,e,i(1)],void 0===(s=function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,r){void 0===r&&(r={}),this.settings=t,i.proliferate(this,t.defaults),i.proliferate(this,r),this.key=e,this.hasOwnProperty("value")||(this.value=this.valueDefault),!{}.hasOwnProperty.call(t.storage,""+t.prefix+e)?this.updateStorage():(this.value=this.retrieveLocalStorage(),this.update())}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t,this.update()},t.prototype.update=function(){this.hasOwnProperty("minimum")&&Number(this.value)<=Number(this.minimum)?(this.value=this.minimum,void 0!==this.onMinimum&&this.onMinimum()):this.hasOwnProperty("maximum")&&Number(this.value)<=Number(this.maximum)&&(this.value=this.maximum,void 0!==this.onMaximum&&this.onMaximum()),this.modularity&&this.checkModularity(),this.triggers&&this.checkTriggers(),this.updateStorage()},t.prototype.updateStorage=function(t){(t||this.settings.autoSave)&&this.settings.storage.setItem(""+this.settings.prefix+this.key,JSON.stringify(this.value))},t.prototype.checkTriggers=function(){this.triggers.hasOwnProperty(this.value)&&this.triggers[this.value](this.value)},t.prototype.checkModularity=function(){if("number"==typeof this.value&&this.modularity)for(;this.value>=this.modularity;)this.value=Math.max(0,this.value-this.modularity),this.onModular&&this.onModular()},t.prototype.retrieveLocalStorage=function(){var t=this.settings.storage.getItem(""+this.settings.prefix+this.key);if(void 0!==t&&"undefined"!==t)return"string"!=typeof t?t:JSON.parse(t)},t}();e.ItemContainer=r}.apply(e,r))||(t.exports=s)}])});
define((function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=2)}([function(t,e,i){var r;void 0===(r=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStorage=function(){var t={clear:function(){for(var e in t)({}).hasOwnProperty.call(t,e)&&delete t[e]},getItem:function(e){return t[e]},key:function(e){return t.keys[e]},get keys(){return Object.keys(t)},get length(){return t.keys.length},removeItem:function(e){delete t[e]},setItem:function(e,i){t[e]=i}};return t}}.apply(e,[i,e]))||(t.exports=r)},function(t,e,i){var r;void 0===(r=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.proliferate=function(t,i,r){for(var s in i)if(i.hasOwnProperty(s)&&(!r||!t.hasOwnProperty(s))){var o=i[s];"object"==typeof o?(t.hasOwnProperty(s)||(t[s]=new o.constructor),e.proliferate(t[s],o,r)):t[s]=o}return t}}.apply(e,[i,e]))||(t.exports=r)},function(t,e,i){var r,s;r=[i,e,i(0),i(3),i(1)],void 0===(s=function(t,e,i,r,s){"use strict";function o(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),o(i),o(r),o(s)}.apply(e,r))||(t.exports=s)},function(t,e,i){var r,s;r=[i,e,i(0),i(4)],void 0===(s=function(t,e,i,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t){void 0===t&&(t={}),this.settings=t,this.autoSave=!!t.autoSave,this.items={},this.itemKeys=[],this.prefix=t.prefix||"",this.values=this.settings.values||{},t.storage?this.storage=t.storage:"undefined"==typeof localStorage?this.storage=i.createStorage():this.storage=localStorage,this.containerSettings={autoSave:this.autoSave,defaults:this.settings.defaults||{},prefix:this.prefix,storage:this.storage}}return Object.defineProperty(t.prototype,"length",{get:function(){return this.itemKeys.length},enumerable:!0,configurable:!0}),t.prototype.key=function(t){return this.itemKeys[t]},t.prototype.getAutoSave=function(){return this.autoSave},t.prototype.setAutoSave=function(t){this.autoSave=t},t.prototype.addItem=function(t,e){this.items[t]=new r.ItemContainer(this.containerSettings,t,e),this.itemKeys.push(t)},t.prototype.getItem=function(t){return this.checkExistence(t),this.items[t].getValue()},t.prototype.removeItem=function(t){({}).hasOwnProperty.call(this.items,t)&&(this.itemKeys.splice(this.itemKeys.indexOf(t),1),delete this.items[t],this.storage.removeItem(""+this.prefix+t),{}.hasOwnProperty.call(this.values,t)&&this.addItem(t,this.values[t]))},t.prototype.setItem=function(t,e){this.checkExistence(t),this.items[t].setValue(e)},t.prototype.increase=function(t,e){void 0===e&&(e=1),this.checkExistence(t);var i=this.items[t].getValue()+e;this.items[t].setValue(i)},t.prototype.decrease=function(t,e){void 0===e&&(e=1),this.checkExistence(t);var i=this.items[t].getValue()-e;this.items[t].setValue(i)},t.prototype.toggle=function(t){this.checkExistence(t);var e=!this.items[t].getValue();this.items[t].setValue(e)},t.prototype.hasKey=function(t){return{}.hasOwnProperty.call(this.items,t)},t.prototype.exportItems=function(){for(var t={},e=0,i=this.itemKeys;e<i.length;e++){var r=i[e];t[r]=this.items[r].getValue()}return t},t.prototype.clear=function(){for(var t=0,e=this.itemKeys;t<e.length;t++){var i=e[t];this.storage.removeItem(""+this.prefix+i)}for(var i in this.items={},this.itemKeys=[],this.values)({}).hasOwnProperty.call(this.values,i)&&this.addItem(i,this.values[i])},t.prototype.saveItem=function(t){if(!{}.hasOwnProperty.call(this.items,t))throw new Error("Unknown key given to ItemsHoldr: '"+t+"'.");this.items[t].updateStorage(!0)},t.prototype.saveAll=function(){for(var t in this.items)this.items[t].updateStorage(!0)},t.prototype.resetAll=function(){this.items={},this.itemKeys=[]},t.prototype.checkExistence=function(t){({}).hasOwnProperty.call(this.items,t)||this.addItem(t,this.values[t])},t}();e.ItemsHoldr=s}.apply(e,r))||(t.exports=s)},function(t,e,i){var r,s;r=[i,e,i(1)],void 0===(s=function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,r){void 0===r&&(r={}),this.settings=t,i.proliferate(this,t.defaults),i.proliferate(this,r),this.key=e,this.hasOwnProperty("value")||(this.value=this.valueDefault),!{}.hasOwnProperty.call(t.storage,""+t.prefix+e)?this.updateStorage():(this.value=this.retrieveLocalStorage(),this.update())}return t.prototype.getValue=function(){return this.value},t.prototype.setValue=function(t){this.value=t,this.update()},t.prototype.update=function(){this.hasOwnProperty("minimum")&&Number(this.value)<=Number(this.minimum)?(this.value=this.minimum,void 0!==this.onMinimum&&this.onMinimum()):this.hasOwnProperty("maximum")&&Number(this.value)<=Number(this.maximum)&&(this.value=this.maximum,void 0!==this.onMaximum&&this.onMaximum()),this.modularity&&this.checkModularity(),this.triggers&&this.checkTriggers(),this.updateStorage()},t.prototype.updateStorage=function(t){(t||this.settings.autoSave)&&this.settings.storage.setItem(""+this.settings.prefix+this.key,JSON.stringify(this.value))},t.prototype.checkTriggers=function(){this.triggers.hasOwnProperty(this.value)&&this.triggers[this.value](this.value)},t.prototype.checkModularity=function(){if("number"==typeof this.value&&this.modularity)for(;this.value>=this.modularity;)this.value=Math.max(0,this.value-this.modularity),this.onModular&&this.onModular()},t.prototype.retrieveLocalStorage=function(){var t=this.settings.storage.getItem(""+this.settings.prefix+this.key);if(void 0!==t&&"undefined"!==t)return"string"!=typeof t?t:JSON.parse(t)},t}();e.ItemContainer=r}.apply(e,r))||(t.exports=s)}])}));

@@ -23,3 +23,3 @@ {

"istanbul": "^0.4.5",
"lolex": "^3.1.0",
"lolex": "^4.0.1",
"mkdirp": "^0.5.1",

@@ -86,3 +86,3 @@ "mocha": "^6.1.3",

"types": "./src/index.d.ts",
"version": "0.7.9"
"version": "0.7.10"
}

@@ -13,4 +13,5 @@ {

"no-unsafe-any": false,
"strict-boolean-expressions": false
"strict-boolean-expressions": false,
"strict-string-expressions": false
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc