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

vue-localstorage

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-localstorage - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

50

dist/vue-local-storage.es2015.js
/**
* vue-local-storage v0.3.0
* (c) 2017 Abdelrahman Awad
* vue-local-storage v0.4.0
* (c) 2017 Alexander Avakov
* @license MIT
*/
const ls$1 = window.localStorage;
const ls = window.localStorage;

@@ -24,3 +24,3 @@ class VueLocalStorage {

get (lsKey, defaultValue = null) {
if (ls$1[lsKey]) {
if (ls[lsKey]) {
let type = String;

@@ -35,3 +35,3 @@

return this._process(type, ls$1[lsKey])
return this._process(type, ls[lsKey])
}

@@ -54,3 +54,3 @@

if ((key === lsKey) && [Array, Object].includes(type)) {
ls$1.setItem(lsKey, JSON.stringify(value));
ls.setItem(lsKey, JSON.stringify(value));

@@ -61,3 +61,3 @@ return value

ls$1.setItem(lsKey, value);
ls.setItem(lsKey, value);

@@ -73,3 +73,3 @@ return value

remove (lsKey) {
return ls$1.removeItem(lsKey)
return ls.removeItem(lsKey)
}

@@ -89,4 +89,4 @@

if (!ls$1[key] && defaultValue !== null) {
ls$1.setItem(key, [Array, Object].includes(type) ? JSON.stringify(defaultValue) : defaultValue);
if (!ls[key] && defaultValue !== null) {
ls.setItem(key, [Array, Object].includes(type) ? JSON.stringify(defaultValue) : defaultValue);
}

@@ -131,13 +131,2 @@ }

const ls = window.localStorage;
try {
const test = '__vue-localstorage-test__';
ls.setItem(test, test);
ls.removeItem(test);
} catch (e) {
console.error('Local storage is not supported');
}
var index = {

@@ -151,2 +140,21 @@ /**

install: (Vue, options = {}) => {
if (process &&
(
process.server ||
process.SERVER_BUILD ||
(process.env && process.env.VUE_ENV === 'server')
)
) {
return
}
try {
const test = '__vue-localstorage-test__';
window.localStorage.setItem(test, test);
window.localStorage.removeItem(test);
} catch (e) {
console.error('Local storage is not supported');
}
const name = options.name || 'localStorage';

@@ -153,0 +161,0 @@

/**
* vue-local-storage v0.3.0
* (c) 2017 Abdelrahman Awad
* vue-local-storage v0.4.0
* (c) 2017 Alexander Avakov
* @license MIT

@@ -12,3 +12,3 @@ */

var ls$1 = window.localStorage;
var ls = window.localStorage;

@@ -30,3 +30,3 @@ var VueLocalStorage = function VueLocalStorage () {

if (ls$1[lsKey]) {
if (ls[lsKey]) {
var type = String;

@@ -41,3 +41,3 @@

return this._process(type, ls$1[lsKey])
return this._process(type, ls[lsKey])
}

@@ -62,3 +62,3 @@

if ((key === lsKey) && [Array, Object].includes(type)) {
ls$1.setItem(lsKey, JSON.stringify(value));
ls.setItem(lsKey, JSON.stringify(value));

@@ -69,3 +69,3 @@ return value

ls$1.setItem(lsKey, value);
ls.setItem(lsKey, value);

@@ -81,3 +81,3 @@ return value

VueLocalStorage.prototype.remove = function remove (lsKey) {
return ls$1.removeItem(lsKey)
return ls.removeItem(lsKey)
};

@@ -97,4 +97,4 @@

if (!ls$1[key] && defaultValue !== null) {
ls$1.setItem(key, [Array, Object].includes(type) ? JSON.stringify(defaultValue) : defaultValue);
if (!ls[key] && defaultValue !== null) {
ls.setItem(key, [Array, Object].includes(type) ? JSON.stringify(defaultValue) : defaultValue);
}

@@ -138,13 +138,2 @@ };

var ls = window.localStorage;
try {
var test = '__vue-localstorage-test__';
ls.setItem(test, test);
ls.removeItem(test);
} catch (e) {
console.error('Local storage is not supported');
}
var index = {

@@ -160,2 +149,21 @@ /**

if (process &&
(
process.server ||
process.SERVER_BUILD ||
(process.env && process.env.VUE_ENV === 'server')
)
) {
return
}
try {
var test = '__vue-localstorage-test__';
window.localStorage.setItem(test, test);
window.localStorage.removeItem(test);
} catch (e) {
console.error('Local storage is not supported');
}
var name = options.name || 'localStorage';

@@ -162,0 +170,0 @@

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueLocalStorage=e()}(this,function(){"use strict";var t=window.localStorage,e=function(){this._properties={}};e.prototype.get=function(e,r){var o=this;if(void 0===r&&(r=null),t[e]){var n=String;for(var i in o._properties)if(i===e){n=o._properties[i].type;break}return this._process(n,t[e])}return null!==r?r:null},e.prototype.set=function(e,r){var o=this;for(var n in o._properties){var i=o._properties[n].type;if(n===e&&[Array,Object].includes(i))return t.setItem(e,JSON.stringify(r)),r}return t.setItem(e,r),r},e.prototype.remove=function(e){return t.removeItem(e)},e.prototype.addProperty=function(e,r,o){r=r||String,this._properties[e]={type:r},t[e]||null===o||t.setItem(e,[Array,Object].includes(r)?JSON.stringify(o):o)},e.prototype._process=function(t,e){switch(t){case Boolean:return"true"===e;case Number:return parseInt(e,10);case Array:try{var r=JSON.parse(e);return Array.isArray(r)?r:[]}catch(t){return[]}case Object:try{return JSON.parse(e)}catch(t){return{}}default:return e}};var r=new e,o=window.localStorage;try{var n="__vue-localstorage-test__";o.setItem(n,n),o.removeItem(n)}catch(t){console.error("Local storage is not supported")}return{install:function(t,e){void 0===e&&(e={});var o=e.name||"localStorage";t.mixin({created:function(){var t=this;this.$options[o]&&Object.keys(this.$options[o]).forEach(function(e){var n=[t.$options[o][e].type,t.$options[o][e].default],i=n[0],s=n[1];r.addProperty(e,i,s)})}}),t[o]=r,t.prototype["$"+o]=r}}});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):e.VueLocalStorage=r()}(this,function(){"use strict";var e=window.localStorage,r=function(){this._properties={}};r.prototype.get=function(r,t){var o=this;if(void 0===t&&(t=null),e[r]){var n=String;for(var s in o._properties)if(s===r){n=o._properties[s].type;break}return this._process(n,e[r])}return null!==t?t:null},r.prototype.set=function(r,t){var o=this;for(var n in o._properties){var s=o._properties[n].type;if(n===r&&[Array,Object].includes(s))return e.setItem(r,JSON.stringify(t)),t}return e.setItem(r,t),t},r.prototype.remove=function(r){return e.removeItem(r)},r.prototype.addProperty=function(r,t,o){t=t||String,this._properties[r]={type:t},e[r]||null===o||e.setItem(r,[Array,Object].includes(t)?JSON.stringify(o):o)},r.prototype._process=function(e,r){switch(e){case Boolean:return"true"===r;case Number:return parseInt(r,10);case Array:try{var t=JSON.parse(r);return Array.isArray(t)?t:[]}catch(e){return[]}case Object:try{return JSON.parse(r)}catch(e){return{}}default:return r}};var t=new r;return{install:function(e,r){if(void 0===r&&(r={}),!process||!(process.server||process.SERVER_BUILD||process.env&&"server"===process.env.VUE_ENV)){try{var o="__vue-localstorage-test__";window.localStorage.setItem(o,o),window.localStorage.removeItem(o)}catch(e){console.error("Local storage is not supported")}var n=r.name||"localStorage";e.mixin({created:function(){var e=this;this.$options[n]&&Object.keys(this.$options[n]).forEach(function(r){var o=[e.$options[n][r].type,e.$options[n][r].default],s=o[0],i=o[1];t.addProperty(r,s,i)})}}),e[n]=t,e.prototype["$"+n]=t}}}});
{
"name": "vue-localstorage",
"description": "Vue.js localStorage plugin with types support",
"version": "0.4.0",
"version": "0.4.1",
"author": {

@@ -6,0 +6,0 @@ "name": "Alexander Avakov",

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