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

vue2-storage

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue2-storage - npm Package Compare versions

Comparing version 3.0.0 to 3.3.0

10

dist/vue2-storage.common.js
/*!
* vue2-storage v3.0.0
* vue2-storage v3.3.0
* (c) 2018 Yarkov Aleksey

@@ -62,7 +62,7 @@ * Released under the MIT License.

prototypeAccessors.name.get = function () {
return 'vue2-storage[v3.0.0]'
return 'vue2-storage[v3.3.0]'
};
prototypeAccessors.version.get = function () {
return '3.0.0'
return '3.3.0'
};

@@ -216,3 +216,5 @@

function Vue2Storage (Vue, options) {
Vue.prototype.$storage = new Storage(options);
var storage = new Storage(options);
Vue['$storage'] = storage;
Vue.prototype.$storage = storage;
}

@@ -219,0 +221,0 @@

/*!
* vue2-storage v3.0.0
* vue2-storage v3.3.0
* (c) 2018 Yarkov Aleksey

@@ -66,7 +66,7 @@ * Released under the MIT License.

prototypeAccessors.name.get = function () {
return 'vue2-storage[v3.0.0]'
return 'vue2-storage[v3.3.0]'
};
prototypeAccessors.version.get = function () {
return '3.0.0'
return '3.3.0'
};

@@ -220,3 +220,5 @@

function Vue2Storage (Vue, options) {
Vue.prototype.$storage = new Storage(options);
var storage = new Storage(options);
Vue['$storage'] = storage;
Vue.prototype.$storage = storage;
}

@@ -223,0 +225,0 @@

4

dist/vue2-storage.min.js
/*!
* vue2-storage v3.0.0
* vue2-storage v3.3.0
* (c) 2018 Yarkov Aleksey
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Vue2Storage=e()}(this,function(){"use strict";function t(t,e){t.prototype.$storage=new n(e)}var e={},r=function(){},o={length:{},storage:{}};o.length.get=function(){return Object.keys(this.storage).length},o.storage.get=function(){return e},r.prototype.getItem=function(t){return t in this.storage?this.storage[t]:null},r.prototype.setItem=function(t,e){this.storage[t]=e},r.prototype.removeItem=function(t){t in this.storage&&delete this.storage[t]},r.prototype.clear=function(){var t=this;for(var e in this.storage)delete t.storage[e]},Object.defineProperties(r.prototype,o);var i=new r,n=function(t){void 0===t&&(t={}),this.setOptions(t)},s={name:{},version:{},length:{},driver:{}};return s.name.get=function(){return"vue2-storage[v3.0.0]"},s.version.get=function(){return"3.0.0"},s.length.get=function(){return this.keys().length},s.driver.get=function(){switch(this.options.driver){case"local":default:return"undefined"!=typeof window?window.localStorage:i;case"session":return"undefined"!=typeof window?window.sessionStorage:i;case"memory":return i}},n.prototype.setOptions=function(t){void 0===t&&(t={});var e=Object.assign({prefix:"app_",driver:"local",ttl:864e5},t);this.options=Object.freeze(e)},n.prototype.printError=function(t){console.error(this.name+": "+t.stack)},n.prototype.addPrefix=function(t){return""+(this.options.prefix||"")+t},n.prototype.removePrefix=function(t){var e=new RegExp("^"+(this.options.prefix||""));return t.replace(e,"")},n.prototype.toJSON=function(t,e){void 0===e&&(e={});var r="ttl"in e?e.ttl:this.options.ttl;return JSON.stringify({value:t,ttl:Date.now()+r})},n.prototype.fromJSON=function(t){try{var e=JSON.parse(this.driver.getItem(t));return null!==e?"ttl"in e&&Number(e.ttl)<Date.now()?(this.remove(this.removePrefix(t)),null):"value"in e?e.value:e:null}catch(t){return null}},n.prototype.get=function(t,e){void 0===e&&(e=null);try{var r=this.fromJSON(this.addPrefix(t));return null===r?e:r}catch(t){this.printError(t)}},n.prototype.set=function(t,e,r){void 0===r&&(r={});try{this.driver.setItem(this.addPrefix(t),this.toJSON(e,r))}catch(t){this.printError(t)}},n.prototype.remove=function(t){try{this.driver.removeItem(this.addPrefix(t))}catch(t){this.printError(t)}},n.prototype.clear=function(t){var e=this;void 0===t&&(t=!1);try{if(t)this.driver.clear();else{this.keys().filter(function(t){return t.startsWith(e.options.prefix||"")}).forEach(function(t){return e.remove(e.removePrefix(t))})}}catch(t){this.printError(t)}},n.prototype.has=function(t){return"memory"!==this.options.driver?this.addPrefix(t)in this.driver:this.addPrefix(t)in this.driver.storage},n.prototype.key=function(t){try{var e=this.keys()[t];return this.get(this.removePrefix(e))}catch(t){this.printError(t)}},n.prototype.keys=function(){return"memory"!==this.options.driver?Object.keys(this.driver):Object.keys(this.driver.storage)},Object.defineProperties(n.prototype,s),window.Vue2Storage=t,t});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Vue2Storage=e()}(this,function(){"use strict";function t(t,e){var r=new n(e);t.$storage=r,t.prototype.$storage=r}var e={},r=function(){},o={length:{},storage:{}};o.length.get=function(){return Object.keys(this.storage).length},o.storage.get=function(){return e},r.prototype.getItem=function(t){return t in this.storage?this.storage[t]:null},r.prototype.setItem=function(t,e){this.storage[t]=e},r.prototype.removeItem=function(t){t in this.storage&&delete this.storage[t]},r.prototype.clear=function(){var t=this;for(var e in this.storage)delete t.storage[e]},Object.defineProperties(r.prototype,o);var i=new r,n=function(t){void 0===t&&(t={}),this.setOptions(t)},s={name:{},version:{},length:{},driver:{}};return s.name.get=function(){return"vue2-storage[v3.3.0]"},s.version.get=function(){return"3.3.0"},s.length.get=function(){return this.keys().length},s.driver.get=function(){switch(this.options.driver){case"local":default:return"undefined"!=typeof window?window.localStorage:i;case"session":return"undefined"!=typeof window?window.sessionStorage:i;case"memory":return i}},n.prototype.setOptions=function(t){void 0===t&&(t={});var e=Object.assign({prefix:"app_",driver:"local",ttl:864e5},t);this.options=Object.freeze(e)},n.prototype.printError=function(t){console.error(this.name+": "+t.stack)},n.prototype.addPrefix=function(t){return""+(this.options.prefix||"")+t},n.prototype.removePrefix=function(t){var e=new RegExp("^"+(this.options.prefix||""));return t.replace(e,"")},n.prototype.toJSON=function(t,e){void 0===e&&(e={});var r="ttl"in e?e.ttl:this.options.ttl;return JSON.stringify({value:t,ttl:Date.now()+r})},n.prototype.fromJSON=function(t){try{var e=JSON.parse(this.driver.getItem(t));return null!==e?"ttl"in e&&Number(e.ttl)<Date.now()?(this.remove(this.removePrefix(t)),null):"value"in e?e.value:e:null}catch(t){return null}},n.prototype.get=function(t,e){void 0===e&&(e=null);try{var r=this.fromJSON(this.addPrefix(t));return null===r?e:r}catch(t){this.printError(t)}},n.prototype.set=function(t,e,r){void 0===r&&(r={});try{this.driver.setItem(this.addPrefix(t),this.toJSON(e,r))}catch(t){this.printError(t)}},n.prototype.remove=function(t){try{this.driver.removeItem(this.addPrefix(t))}catch(t){this.printError(t)}},n.prototype.clear=function(t){var e=this;void 0===t&&(t=!1);try{if(t)this.driver.clear();else{this.keys().filter(function(t){return t.startsWith(e.options.prefix||"")}).forEach(function(t){return e.remove(e.removePrefix(t))})}}catch(t){this.printError(t)}},n.prototype.has=function(t){return"memory"!==this.options.driver?this.addPrefix(t)in this.driver:this.addPrefix(t)in this.driver.storage},n.prototype.key=function(t){try{var e=this.keys()[t];return this.get(this.removePrefix(e))}catch(t){this.printError(t)}},n.prototype.keys=function(){return"memory"!==this.options.driver?Object.keys(this.driver):Object.keys(this.driver.storage)},Object.defineProperties(n.prototype,s),window.Vue2Storage=t,t});
{
"name": "vue2-storage",
"description": "Browser storage for Vue.js app",
"version": "3.0.0",
"version": "3.3.0",
"author": {

@@ -40,10 +40,11 @@ "name": "Yarkov Aleksey",

"unpkg": "dist/vue2-storage.js",
"typings": "types/index.d.ts",
"keywords": [
"plugin",
"vue",
"vuejs",
"plugin",
"storage",
"localStorage",
"sessionStorage",
"cookie"
"memoryStorage",
"sessionStorage"
],

@@ -50,0 +51,0 @@ "license": "MIT",

@@ -6,3 +6,5 @@ /* @flow */

function Vue2Storage (Vue: any, options: StorageOptions) {
Vue.prototype.$storage = new Storage(options)
const storage = new Storage(options)
Vue['$storage'] = storage
Vue.prototype.$storage = storage
}

@@ -9,0 +11,0 @@

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