Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "vue-ls", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Vue plugin for work with LocalStorage from Vue context", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-ls.js", |
@@ -19,3 +19,3 @@ (function (global, factory) { | ||
removeItem: function removeItem(name) { | ||
var found = key in ls; | ||
var found = name in ls; | ||
@@ -22,0 +22,0 @@ if (found) { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e["vue-ls"]=t()}(this,function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(){return"undefined"!=typeof window&&"localStorage"in window?window.localStorage:r}function n(e){function t(t){var n=JSON.parse(e.newValue),o=JSON.parse(e.oldValue),r="object"===("undefined"==typeof n?"undefined":a(n))?n.value:o,i=o&&"object"===("undefined"==typeof o?"undefined":a(o))?o.value:o;t(r,i,e.url||e.uri)}e||(e=window.event);var n=s[e.key];n&&n.forEach(t)}var o={},r={getItem:function(e){return e in o?o[e]:null},setItem:function(e,t){return o[e]=t,!0},removeItem:function(e){var t=key in o;return!!t&&delete o[e]},clear:function(){return o={},!0}},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s={};try{var f=t(),l="__storage_test__";f.setItem(l,l),f.removeItem(l)}catch(e){throw new Error("Local storage not supported by this browser")}var c=function(){function o(r){e(this,o),this.storage=t(),this.options=i({namespace:""},r||{}),window.addEventListener?window.addEventListener("storage",n,!1):window.attachEvent?window.attachEvent("onstorage",n):window.onstorage=n,Object.defineProperty(this,"length",{get:function(){return this.storage.length}})}return u(o,[{key:"install",value:function(e,t){this.options=i(this.options,t||{});var n=this;e.localStorage=n,e.ls=n,Object.defineProperty(e.prototype,"$localStorage",{get:function(){return n}}),Object.defineProperty(e.prototype,"$ls",{get:function(){return n}})}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.storage.setItem(this.options.namespace+e,JSON.stringify({value:t,expire:null!==n?(new Date).getTime()+n:null}))}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.storage.getItem(this.options.namespace+e);if(null!==n){var o=JSON.parse(n);if(null===o.expire)return o.value;if(o.expire>=(new Date).getTime())return o.value;this.remove(e)}return t}},{key:"key",value:function(e){return this.storage.key(e)}},{key:"remove",value:function(e){return this.storage.removeItem(this.options.namespace+e)}},{key:"clear",value:function(){if(0!==this.length)for(var e=0;e<this.length;e++){var t=this.storage.key(e),n=new RegExp("^"+this.options.namespace+".+","i");n.test(t)!==!1&&this.storage.removeItem(t)}}},{key:"on",value:function(e,t){s[e]?s[e].push(t):s[e]=[t]}},{key:"off",value:function(e,t){var n=s[e];n.length>1?n.splice(n.indexOf(t),1):s[e]=[]}}]),o}();return"undefined"!=typeof window&&"undefined"!=typeof window.Vue&&window.Vue.use(new c),c}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e["vue-ls"]=t()}(this,function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(){return"undefined"!=typeof window&&"localStorage"in window?window.localStorage:r}function n(e){function t(t){var n=JSON.parse(e.newValue),o=JSON.parse(e.oldValue),r="object"===("undefined"==typeof n?"undefined":a(n))?n.value:o,i=o&&"object"===("undefined"==typeof o?"undefined":a(o))?o.value:o;t(r,i,e.url||e.uri)}e||(e=window.event);var n=s[e.key];n&&n.forEach(t)}var o={},r={getItem:function(e){return e in o?o[e]:null},setItem:function(e,t){return o[e]=t,!0},removeItem:function(e){var t=e in o;return!!t&&delete o[e]},clear:function(){return o={},!0}},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s={};try{var f=t(),l="__storage_test__";f.setItem(l,l),f.removeItem(l)}catch(e){throw new Error("Local storage not supported by this browser")}var c=function(){function o(r){e(this,o),this.storage=t(),this.options=i({namespace:""},r||{}),window.addEventListener?window.addEventListener("storage",n,!1):window.attachEvent?window.attachEvent("onstorage",n):window.onstorage=n,Object.defineProperty(this,"length",{get:function(){return this.storage.length}})}return u(o,[{key:"install",value:function(e,t){this.options=i(this.options,t||{});var n=this;e.localStorage=n,e.ls=n,Object.defineProperty(e.prototype,"$localStorage",{get:function(){return n}}),Object.defineProperty(e.prototype,"$ls",{get:function(){return n}})}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.storage.setItem(this.options.namespace+e,JSON.stringify({value:t,expire:null!==n?(new Date).getTime()+n:null}))}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.storage.getItem(this.options.namespace+e);if(null!==n){var o=JSON.parse(n);if(null===o.expire)return o.value;if(o.expire>=(new Date).getTime())return o.value;this.remove(e)}return t}},{key:"key",value:function(e){return this.storage.key(e)}},{key:"remove",value:function(e){return this.storage.removeItem(this.options.namespace+e)}},{key:"clear",value:function(){if(0!==this.length)for(var e=0;e<this.length;e++){var t=this.storage.key(e),n=new RegExp("^"+this.options.namespace+".+","i");n.test(t)!==!1&&this.storage.removeItem(t)}}},{key:"on",value:function(e,t){s[e]?s[e].push(t):s[e]=[t]}},{key:"off",value:function(e,t){var n=s[e];n.length>1?n.splice(n.indexOf(t),1):s[e]=[]}}]),o}();return"undefined"!=typeof window&&"undefined"!=typeof window.Vue&&window.Vue.use(new c),c}); | ||
//# sourceMappingURL=vue-ls.min.js.map |
{ | ||
"name": "vue-ls", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Vue plugin for work with LocalStorage from Vue context", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-ls.js", |
@@ -15,3 +15,3 @@ let ls = {}; | ||
removeItem (name) { | ||
var found = key in ls; | ||
var found = name in ls; | ||
@@ -18,0 +18,0 @@ if (found) { |
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
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