itemsholdr
Advanced tools
Comparing version 0.7.8 to 0.7.9
{ | ||
"editor.tabSize": 4, | ||
"editor.trimAutoWhitespace": true, | ||
"files.exclude": { | ||
"**/*.d.ts": true, | ||
"**/*.js.map": true, | ||
"**/*.js": { "when": "$(basename).ts" }, | ||
"**/*?.js": { "when": "$(basename).tsx" } | ||
}, | ||
"tslint.alwaysShowRuleFailuresAsWarnings": true, | ||
@@ -5,0 +11,0 @@ "tslint.autoFixOnSave": true, |
@@ -1,1 +0,1 @@ | ||
define(function(){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},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=4)}([function(t,e,i){var s;void 0===(s=function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.proliferate=function(t,i,s){for(var r in i)if(i.hasOwnProperty(r)&&(!s||!t.hasOwnProperty(r))){var o=i[r];"object"==typeof o?(t.hasOwnProperty(r)||(t[r]=new o.constructor),e.proliferate(t[r],o,s)):t[r]=o}return t}}.apply(e,[i,e]))||(t.exports=s)},function(t,e,i){var s;void 0===(s=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=s)},function(t,e,i){var s,r;s=[i,e,i(0)],void 0===(r=function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e,s){void 0===s&&(s={}),this.settings=t,i.proliferate(this,t.defaults),i.proliferate(this,s),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=s}.apply(e,s))||(t.exports=r)},function(t,e,i){var s,r;s=[i,e,i(1),i(2)],void 0===(r=function(t,e,i,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=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 s.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 s=i[e];t[s]=this.items[s].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.checkExistence=function(t){({}).hasOwnProperty.call(this.items,t)||this.addItem(t,this.values[t])},t}();e.ItemsHoldr=r}.apply(e,s))||(t.exports=r)},function(t,e,i){var s,r;s=[i,e,i(1),i(3),i(0)],void 0===(r=function(t,e,i,s,r){"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(s),o(r)}.apply(e,s))||(t.exports=r)}])}); | ||
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)}])}); |
@@ -10,32 +10,32 @@ { | ||
}, | ||
"dependencies": { | ||
}, | ||
"dependencies": {}, | ||
"description": "Cache-based wrapper around localStorage.", | ||
"devDependencies": { | ||
"@types/chai": "^4.1.3", | ||
"@types/lodash": "^4.14.109", | ||
"@types/lolex": "^2.1.2", | ||
"@types/mocha": "^5.2.1", | ||
"@types/sinon": "^5.0.1", | ||
"@types/sinon-chai": "^2.7.32", | ||
"chai": "^4.1.2", | ||
"concurrently": "^3.5.1", | ||
"glob": "^7.1.2", | ||
"@types/chai": "^4.1.7", | ||
"@types/lodash": "^4.14.123", | ||
"@types/lolex": "^3.1.1", | ||
"@types/mocha": "^5.2.6", | ||
"@types/sinon": "^7.0.11", | ||
"@types/sinon-chai": "^3.2.2", | ||
"chai": "^4.2.0", | ||
"concurrently": "^4.1.0", | ||
"glob": "^7.1.3", | ||
"istanbul": "^0.4.5", | ||
"lolex": "^2.7.0", | ||
"lolex": "^3.1.0", | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^5.2.0", | ||
"mocha-headless-chrome": "^2.0.0", | ||
"requirejs": "^2.3.5", | ||
"mocha": "^6.1.3", | ||
"mocha-headless-chrome": "^2.0.2", | ||
"npm-check-updates": "^3.1.7", | ||
"requirejs": "^2.3.6", | ||
"run-for-every-file": "^1.1.0", | ||
"shenanigans-manager": "^0.2.31", | ||
"sinon": "^5.1.0", | ||
"sinon-chai": "^3.1.0", | ||
"tslint": "5.10.0", | ||
"tsutils": "^2.27.1", | ||
"typedoc": "^0.11.1", | ||
"typescript": "^2.9.1", | ||
"shenanigans-manager": "^0.2.36", | ||
"sinon": "^7.3.1", | ||
"sinon-chai": "^3.3.0", | ||
"tslint": "5.15.0", | ||
"tsutils": "^3.10.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.3", | ||
"watch": "^1.0.2", | ||
"webpack": "^4.11.1", | ||
"webpack-cli": "^3.0.3" | ||
"webpack": "^4.30.0", | ||
"webpack-cli": "^3.3.0" | ||
}, | ||
@@ -54,2 +54,3 @@ "license": "MIT", | ||
"init": "npm install && npm run setup && npm run verify", | ||
"ncu": "ncu -u", | ||
"setup": "npm run setup:dirs && npm run setup:copy && npm run setup:package && npm run setup:readme", | ||
@@ -64,2 +65,3 @@ "setup:copy": "npm run setup:copy:default", | ||
"src:tslint": "tslint -c tslint.json -p tsconfig.json -t stylish", | ||
"src:tslint:fix": "tslint -c tslint.json --fix -p tsconfig.json -t stylish", | ||
"test": "npm run test:setup && npm run test:run", | ||
@@ -78,4 +80,4 @@ "test:coverage": "npm run test:coverage:generate-html && npm run test:coverage:instrument && npm run test:coverage:run && npm run test:coverage:report", | ||
"test:setup:tsc": "tsc -p test", | ||
"verify": "npm run src && npm run test && npm run dist && npm run docs", | ||
"verify:coverage": "npm run src && npm run test:setup && npm run test:coverage && npm run dist && npm run docs", | ||
"verify": "npm run src && npm run test && npm run dist", | ||
"verify:coverage": "npm run src && npm run test:setup && npm run test:coverage && npm run dist", | ||
"watch": "concurrently \"tsc -p . -w\" --raw \"chokidar src/**/*.test.t* --command \"\"npm run test:setup:html\"\" --silent\" --raw" | ||
@@ -87,3 +89,3 @@ }, | ||
"types": "./src/index.d.ts", | ||
"version": "0.7.8" | ||
} | ||
"version": "0.7.9" | ||
} |
@@ -1,8 +0,11 @@ | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -9,0 +12,0 @@ define(["require", "exports", "./createStorage", "./ItemsHoldr"], function (require, exports, createStorage_1, ItemsHoldr_1) { |
@@ -7,11 +7,15 @@ { | ||
"jsx": "react", | ||
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"], | ||
"lib": ["dom", "es2015"], | ||
"module": "amd", | ||
"moduleResolution": "node", | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"pretty": true, | ||
"strictNullChecks": true, | ||
"strict": true, | ||
"strictFunctionTypes": false, | ||
"strictPropertyInitialization": false, | ||
"target": "es5" | ||
@@ -18,0 +22,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
1
65129
27
29
1147