New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aofl/cache-manager

Package Overview
Dependencies
Maintainers
2
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/cache-manager - npm Package Compare versions

Comparing version 4.0.0-alpha.11 to 4.0.0-alpha.13

2

dist/index.js

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

module.exports=function(){"use strict";var e={250:function(e,t,r){r.r(t),r.d(t,{CacheManager:function(){return g},MemoryStorage:function(){return c},cacheTypeEnumerate:function(){return h}});var s,n=require("@babel/runtime/helpers/classCallCheck"),i=r.n(n),o=require("@babel/runtime/helpers/createClass"),a=r.n(o),u=require("@babel/runtime/helpers/defineProperty"),l=r.n(u),h={MEMORY:0,LOCAL:1,SESSION:2},c=function(){function e(){i()(this,e)}return a()(e,null,[{key:"clear",value:function(){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&e.removeItem(t)}},{key:"getItem",value:function(t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}},{key:"setItem",value:function(t,r){e[t]=r}},{key:"removeItem",value:function(t){e[t]=null,delete e[t]}},{key:"size",get:function(){var t=0;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}}]),e}(),y=require("tiny-js-md5"),p=r.n(y),v=(s={},l()(s,h.LOCAL,localStorage),l()(s,h.SESSION,sessionStorage),l()(s,h.MEMORY,c),s),f=Symbol("expire"),g=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.MEMORY,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:36e5;i()(this,e),this.storage=v[r],this.storageType=r,this.namespace=t,this.storedKeys=this.getStoredKeys(),this.expire=s}return a()(e,[{key:"getStoredKeys",value:function(){var e=[];for(var t in this.storage)Object.hasOwnProperty.call(this.storage,t)&&0===t.indexOf(this.namespace+"_")&&e.push(t);return e}},{key:"getNamespaceKey",value:function(e){return this.storedKeys.indexOf(e)>-1?e:this.namespace+"_"+p()(e)}},{key:"setItem",value:function(e,t){var r={t:Date.now(),v:t};this.storageType!==h.LOCAL&&this.storageType!==h.SESSION||(r=JSON.stringify(r));var s=this.getNamespaceKey(e);this.storage.setItem(s,r),this.storedKeys.push(s)}},{key:"getItem",value:function(e){var t=this.storage.getItem(this.getNamespaceKey(e));return this.storageType!==h.LOCAL&&this.storageType!==h.SESSION||(t=JSON.parse(t)),null!==t&&Object.hasOwnProperty.call(t,"t")?this.isExpired(e)?(this.removeItem(e),null):t.v:t}},{key:"getCollection",value:function(){var e={};this.storedKeys=this.getStoredKeys();for(var t=0;t<this.storedKeys.length;t++)this.isExpired(this.storedKeys[t])||(e[this.storedKeys[t]]=this.getItem(this.storedKeys[t]));return e}},{key:"removeItem",value:function(e){var t=this.getNamespaceKey(e),r=this.storedKeys.indexOf(t);r>-1&&(this.storage.removeItem(t),this.storedKeys.splice(r,1))}},{key:"clear",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.storage.removeItem(this.storedKeys[e]);this.storedKeys=[]}},{key:"isExpired",value:function(e){if("number"!=typeof this.expire||this.expire<=0)return!1;var t=this.getNamespaceKey(e),r=this.storage.getItem(t);if(this.storageType===h.LOCAL||this.storageType===h.SESSION)try{r=JSON.parse(r)}catch(e){}return null===r||r.t<Date.now()-this.expire}},{key:"removeExpired",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.isExpired(this.storedKeys[e])&&this.removeItem(this.storedKeys[e])}},{key:"destruct",value:function(){clearInterval(this.interval),this.namespace=null,this.storage=null,this.storageType=null,this.expire=null,this.storedKeys=null,this.interval=null}},{key:"expire",get:function(){return this[f]},set:function(e){var t=this;this[f]=e,null!==this.interval&&clearInterval(this.interval),e>0&&e<2147483647&&(this.interval=setInterval((function(){return t.removeExpired()}),e))}},{key:"size",get:function(){var e=this.getCollection();return Object.keys(e).length}}]),e}()}},t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={exports:{}};return e[s](n,n.exports,r),n.exports}return r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(250)}();
!function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{CacheManager:function(){return f},MemoryStorage:function(){return h},cacheTypeEnumerate:function(){return l}});var r,s=require("@babel/runtime/helpers/classCallCheck"),n=e.n(s),i=require("@babel/runtime/helpers/createClass"),o=e.n(i),a=require("@babel/runtime/helpers/defineProperty"),u=e.n(a),l={MEMORY:0,LOCAL:1,SESSION:2},h=function(){function e(){n()(this,e)}return o()(e,null,[{key:"clear",value:function(){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&e.removeItem(t)}},{key:"size",get:function(){var t=0;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}},{key:"getItem",value:function(t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}},{key:"setItem",value:function(t,r){e[t]=r}},{key:"removeItem",value:function(t){e[t]=null,delete e[t]}}]),e}(),c=require("tiny-js-md5"),y=e.n(c),p=(r={},u()(r,l.LOCAL,localStorage),u()(r,l.SESSION,sessionStorage),u()(r,l.MEMORY,h),r),v=Symbol("expire"),f=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.MEMORY,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:36e5;n()(this,e),this.storage=p[r],this.storageType=r,this.namespace=t,this.storedKeys=this.getStoredKeys(),this.expire=s}return o()(e,[{key:"expire",get:function(){return this[v]},set:function(e){var t=this;this[v]=e,null!==this.interval&&clearInterval(this.interval),e>0&&e<2147483647&&(this.interval=setInterval((function(){return t.removeExpired()}),e))}},{key:"size",get:function(){var e=this.getCollection();return Object.keys(e).length}},{key:"getStoredKeys",value:function(){var e=[];for(var t in this.storage)Object.hasOwnProperty.call(this.storage,t)&&0===t.indexOf(this.namespace+"_")&&e.push(t);return e}},{key:"getNamespaceKey",value:function(e){return this.storedKeys.indexOf(e)>-1?e:this.namespace+"_"+y()(e)}},{key:"setItem",value:function(e,t){var r={t:Date.now(),v:t};this.storageType!==l.LOCAL&&this.storageType!==l.SESSION||(r=JSON.stringify(r));var s=this.getNamespaceKey(e);this.storage.setItem(s,r),this.storedKeys.push(s)}},{key:"getItem",value:function(e){var t=this.storage.getItem(this.getNamespaceKey(e));return this.storageType!==l.LOCAL&&this.storageType!==l.SESSION||(t=JSON.parse(t)),null!==t&&Object.hasOwnProperty.call(t,"t")?this.isExpired(e)?(this.removeItem(e),null):t.v:t}},{key:"getCollection",value:function(){var e={};this.storedKeys=this.getStoredKeys();for(var t=0;t<this.storedKeys.length;t++)this.isExpired(this.storedKeys[t])||(e[this.storedKeys[t]]=this.getItem(this.storedKeys[t]));return e}},{key:"removeItem",value:function(e){var t=this.getNamespaceKey(e),r=this.storedKeys.indexOf(t);r>-1&&(this.storage.removeItem(t),this.storedKeys.splice(r,1))}},{key:"clear",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.storage.removeItem(this.storedKeys[e]);this.storedKeys=[]}},{key:"isExpired",value:function(e){if("number"!=typeof this.expire||this.expire<=0)return!1;var t=this.getNamespaceKey(e),r=this.storage.getItem(t);if(this.storageType===l.LOCAL||this.storageType===l.SESSION)try{r=JSON.parse(r)}catch(e){}return null===r||r.t<Date.now()-this.expire}},{key:"removeExpired",value:function(){for(var e=0;e<this.storedKeys.length;e++)this.isExpired(this.storedKeys[e])&&this.removeItem(this.storedKeys[e])}},{key:"destruct",value:function(){clearInterval(this.interval),this.namespace=null,this.storage=null,this.storageType=null,this.expire=null,this.storedKeys=null,this.interval=null}}]),e}();module.exports=t}();
//# sourceMappingURL=index.js.map
{
"name": "@aofl/cache-manager",
"version": "4.0.0-alpha.11",
"version": "4.0.0-alpha.13",
"description": "Provides a unified class for storing objects in Storage-like Objects",

@@ -19,4 +19,4 @@ "main": "index.js",

"build-ci": "cross-env NODE_ENV=production aofl build --debug",
"build": "cross-env NODE_ENV=production npx @aofl/cli build",
"build:dev": "cross-env NODE_ENV=development npx @aofl/cli build",
"build": "cross-env NODE_ENV=production aofl build",
"build:dev": "cross-env NODE_ENV=development aofl build",
"prepublishOnly": "npm run build-ci && npm run docs",

@@ -36,3 +36,3 @@ "docs": "npx jsdoc -c .jsdocrc.json ."

"devDependencies": {
"@aofl/cli": "^4.0.0-alpha.11",
"@aofl/cli": "^4.0.0-alpha.13",
"cross-env": "^7.0.3",

@@ -39,0 +39,0 @@ "jsdoc": "^3.6.6",

Sorry, the diff of this file is not supported yet

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