Comparing version 2.0.0 to 2.0.1
@@ -5,6 +5,6 @@ # Getting started | ||
`npm install xstore` | ||
`npm install xStore` | ||
```js | ||
var xStore = require('xstore') | ||
var xStore = require('xStore') | ||
``` | ||
@@ -11,0 +11,0 @@ |
{ | ||
"name": "xStore", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "src/xStore.js", | ||
"license": "MIT", | ||
"scripts": { | ||
@@ -5,0 +7,0 @@ "test": "grunt test" |
@@ -170,3 +170,3 @@ // Copyright (c) 2012-2016 Florian Hartmann, https://github.com/florian https://github.com/florian/lostorage.js | ||
define(function () { | ||
return xStore; | ||
return { xStore: xStore }; | ||
}); | ||
@@ -173,0 +173,0 @@ } else if (typeof exports !== 'undefined') { |
// 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 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.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); |
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
222536