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

xStore

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xStore - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

package.json
{
"name": "xStore",
"version": "2.0.1",
"version": "2.0.2",
"main": "src/xStore.js",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -24,3 +24,3 @@ # xStore [![Build Status](https://travis-ci.org/florian/xStore.png?branch=master)](https://travis-ci.org/florian/xStore)

store.push('list', 3, 4).increase(counter); // Chaining is awesome
store.push('list', 3, 4).increase('counter'); // Chaining is awesome

@@ -27,0 +27,0 @@ // And read the values:

@@ -45,3 +45,3 @@ // Copyright (c) 2012-2016 Florian Hartmann, https://github.com/florian https://github.com/florian/lostorage.js

return JSON.parse(data);
}
},

@@ -55,5 +55,11 @@ };

xStore.prototype.addPrefix = function (key) {
return this.prefix + key;
};
xStore.prototype.get = function (keys, fallback) {
fallback = fallback || undefined;
var key;

@@ -64,3 +70,3 @@ if (utils.isArray(keys)) {

for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
key = keys[i];
result[key] = this.get(key, fallback);

@@ -71,3 +77,4 @@ }

} else {
return utils.retrieve(utils.unserialize(this.store.getItem(keys)), fallback);
key = this.addPrefix(keys);
return utils.retrieve(utils.unserialize(this.store.getItem(key)), fallback);
}

@@ -86,3 +93,3 @@

} else {
key = this.prefix + key;
key = this.addPrefix(key);
this.store.setItem(key, utils.serialize(value));

@@ -166,3 +173,7 @@ }

var key = this.store.key(i);
obj[key] = utils.unserialize(this.store.getItem(key));
if (key.indexOf(this.prefix) === 0) {
var value = utils.unserialize(this.store.getItem(key));
key = key.substring(this.prefix.length);
obj[key] = value;
}
}

@@ -169,0 +180,0 @@

// Copyright (c) 2012-2016 Florian Hartmann, https://github.com/florian https://github.com/florian/lostorage.js
!function(a,b){var c={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},isPlainObj:function(a){return a===Object(a)},toArray:function(a){return Array.prototype.slice.call(a)},prepareArgs:function(a,b){return a=c.toArray(a),a.unshift(b),a},getObjKeyByValue:function(a,b){for(var c in a)if(a.hasOwnProperty(c)&&a[c]===b)return c},retrieve:function(a,b){return null==a?b:a},serialize:function(a){return JSON.stringify(a)},unserialize:function(a){return null==a?b:JSON.parse(a)}},d=function(a,b){this.prefix=a,this.store=b};d.prototype.get=function(a,d){if(d=d||b,c.isArray(a)){for(var e={},f=0,g=a.length;f<g;f++){var h=a[f];e[h]=this.get(h,d)}return e}return c.retrieve(c.unserialize(this.store.getItem(a)),d)},d.prototype.set=function(a,b){if(c.isPlainObj(a))for(var d in a)a.hasOwnProperty(d)&&this.set(d,a[d]);else a=this.prefix+a,this.store.setItem(a,c.serialize(b));return this},d.prototype.invert=function(a){return this.set(a,!this.get(a))},d.prototype.add=function(a,b){return this.set(a,this.get(a)+parseInt(b,10))},d.prototype.increase=function(a,b){return this.add(a,c.retrieve(b,1))},d.prototype.decrease=function(a,b){return this.add(a,-c.retrieve(b,1))},d.prototype.concat=function(a,b){return this.set(a,this.get(a)+b)},d.prototype.push=function(a,b){var d=c.toArray(arguments),e=this.get(a,[]);return d.splice(0,1),e.push.apply(e,d),this.set(a,e)},d.prototype.extend=function(a,b,d){var e=this.get(a,{});if(c.isPlainObj(b))for(var f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);else e[b]=d;return this.set(a,e)},d.prototype.remove=function(a){a=c.isArray(a)?a:c.toArray(arguments);for(var b=0,d=a.length;b<d;b++)delete this.store[a[b]];return this},d.prototype.empty=function(){return this.store.clear(),this},d.prototype.all=function(){for(var a={},b=0,d=this.store.length;b<d;b++){var e=this.store.key(b);a[e]=c.unserialize(this.store.getItem(e))}return a},"function"==typeof define&&define.amd?define(function(){return{xStore:d}}):"undefined"!=typeof exports?module.exports=d:a.xStore=d}(window);
!function(a,b){var c={isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},isPlainObj:function(a){return a===Object(a)},toArray:function(a){return Array.prototype.slice.call(a)},prepareArgs:function(a,b){return a=c.toArray(a),a.unshift(b),a},getObjKeyByValue:function(a,b){for(var c in a)if(a.hasOwnProperty(c)&&a[c]===b)return c},retrieve:function(a,b){return null==a?b:a},serialize:function(a){return JSON.stringify(a)},unserialize:function(a){return null==a?b:JSON.parse(a)}},d=function(a,b){this.prefix=a,this.store=b};d.prototype.addPrefix=function(a){return this.prefix+a},d.prototype.get=function(a,d){d=d||b;var e;if(c.isArray(a)){for(var f={},g=0,h=a.length;g<h;g++)e=a[g],f[e]=this.get(e,d);return f}return e=this.addPrefix(a),c.retrieve(c.unserialize(this.store.getItem(e)),d)},d.prototype.set=function(a,b){if(c.isPlainObj(a))for(var d in a)a.hasOwnProperty(d)&&this.set(d,a[d]);else a=this.addPrefix(a),this.store.setItem(a,c.serialize(b));return this},d.prototype.invert=function(a){return this.set(a,!this.get(a))},d.prototype.add=function(a,b){return this.set(a,this.get(a)+parseInt(b,10))},d.prototype.increase=function(a,b){return this.add(a,c.retrieve(b,1))},d.prototype.decrease=function(a,b){return this.add(a,-c.retrieve(b,1))},d.prototype.concat=function(a,b){return this.set(a,this.get(a)+b)},d.prototype.push=function(a,b){var d=c.toArray(arguments),e=this.get(a,[]);return d.splice(0,1),e.push.apply(e,d),this.set(a,e)},d.prototype.extend=function(a,b,d){var e=this.get(a,{});if(c.isPlainObj(b))for(var f in b)b.hasOwnProperty(f)&&(e[f]=b[f]);else e[b]=d;return this.set(a,e)},d.prototype.remove=function(a){a=c.isArray(a)?a:c.toArray(arguments);for(var b=0,d=a.length;b<d;b++)delete this.store[a[b]];return this},d.prototype.empty=function(){return this.store.clear(),this},d.prototype.all=function(){for(var a={},b=0,d=this.store.length;b<d;b++){var e=this.store.key(b);if(0===e.indexOf(this.prefix)){var f=c.unserialize(this.store.getItem(e));e=e.substring(this.prefix.length),a[e]=f}}return a},"function"==typeof define&&define.amd?define(function(){return{xStore:d}}):"undefined"!=typeof exports?module.exports=d:a.xStore=d}(window);
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