Comparing version 2.3.0 to 2.3.1
@@ -200,7 +200,7 @@ ;(function(){ | ||
require.register("store/dist/store2.js", function(exports, require, module){ | ||
/*! store2 - v2.3.0 - 2015-05-22 | ||
/*! store2 - v2.3.1 - 2015-10-27 | ||
* Copyright (c) 2015 Nathan Bubna; Licensed MIT, GPL */ | ||
;(function(window, define) { | ||
var _ = { | ||
version: "2.3.0", | ||
version: "2.3.1", | ||
areas: {}, | ||
@@ -245,3 +245,3 @@ apis: {}, | ||
if (data !== undefined){ return store.set(key, data, overwrite); } | ||
if (typeof key === "string"){ return store.get(key); } | ||
if (typeof key === "string" || typeof key === "number"){ return store.get(key); } | ||
if (!key){ return store.clear(); } | ||
@@ -248,0 +248,0 @@ return store.setAll(key, data);// overwrite=data, data=key |
@@ -1,6 +0,6 @@ | ||
/*! store2 - v2.3.0 - 2015-05-22 | ||
/*! store2 - v2.3.1 - 2015-10-27 | ||
* Copyright (c) 2015 Nathan Bubna; Licensed MIT, GPL */ | ||
;(function(window, define) { | ||
var _ = { | ||
version: "2.3.0", | ||
version: "2.3.1", | ||
areas: {}, | ||
@@ -45,3 +45,3 @@ apis: {}, | ||
if (data !== undefined){ return store.set(key, data, overwrite); } | ||
if (typeof key === "string"){ return store.get(key); } | ||
if (typeof key === "string" || typeof key === "number"){ return store.get(key); } | ||
if (!key){ return store.clear(); } | ||
@@ -48,0 +48,0 @@ return store.setAll(key, data);// overwrite=data, data=key |
@@ -1,3 +0,5 @@ | ||
/*! store2 - v2.3.0 - 2015-05-22 | ||
/*! store2 - v2.3.1 - 2015-10-27 | ||
* Copyright (c) 2015 Nathan Bubna; Licensed MIT, GPL */ | ||
(function(t,e){var n={version:"2.3.0",areas:{},apis:{},inherit:function(t,e){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n]);return e},stringify:function(t){return void 0===t||"function"==typeof t?t+"":JSON.stringify(t)},parse:function(t){try{return JSON.parse(t)}catch(e){return t}},fn:function(t,e){n.storeAPI[t]=e;for(var i in n.apis)n.apis[i][t]=e},get:function(t,e){return t.getItem(e)},set:function(t,e,n){t.setItem(e,n)},remove:function(t,e){t.removeItem(e)},key:function(t,e){return t.key(e)},length:function(t){return t.length},clear:function(t){t.clear()},Store:function(t,e,i){var r=n.inherit(n.storeAPI,function(t,e,n){return 0===arguments.length?r.getAll():void 0!==e?r.set(t,e,n):"string"==typeof t?r.get(t):t?r.setAll(t,e):r.clear()});r._id=t;try{var s="_safariPrivate_";e.setItem(s,"sucks"),r._area=e,e.removeItem(s)}catch(a){}return r._area||(r._area=n.inherit(n.storageAPI,{items:{},name:"fake"})),r._ns=i||"",n.areas[t]||(n.areas[t]=r._area),n.apis[r._ns+r._id]||(n.apis[r._ns+r._id]=r),r},storeAPI:{area:function(t,e){var i=this[t];return i&&i.area||(i=n.Store(t,e,this._ns),this[t]||(this[t]=i)),i},namespace:function(t,e){if(!t)return this._ns?this._ns.substring(0,this._ns.length-1):"";var i=t,r=this[i];return r&&r.namespace||(r=n.Store(this._id,this._area,this._ns+i+"."),this[i]||(this[i]=r),e||r.area("session",n.areas.session)),r},isFake:function(){return"fake"===this._area.name},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(t){return this._area.has?this._area.has(this._in(t)):!!(this._in(t)in this._area)},size:function(){return this.keys().length},each:function(t,e){for(var i=0,r=n.length(this._area);r>i;i++){var s=this._out(n.key(this._area,i));if(void 0!==s&&t.call(this,s,e||this.get(s))===!1)break;r>n.length(this._area)&&(r--,i--)}return e||this},keys:function(){return this.each(function(t,e){e.push(t)},[])},get:function(t,e){var i=n.get(this._area,this._in(t));return null!==i?n.parse(i):e||i},getAll:function(){return this.each(function(t,e){e[t]=this.get(t)},{})},set:function(t,e,i){var r=this.get(t);return null!=r&&i===!1?e:n.set(this._area,this._in(t),n.stringify(e),i)||r},setAll:function(t,e){var n,i;for(var r in t)i=t[r],this.set(r,i,e)!==i&&(n=!0);return n},remove:function(t){var e=this.get(t);return n.remove(this._area,this._in(t)),e},clear:function(){return this._ns?this.each(function(t){n.remove(this._area,this._in(t))},1):n.clear(this._area),this},clearAll:function(){var t=this._area;for(var e in n.areas)n.areas.hasOwnProperty(e)&&(this._area=n.areas[e],this.clear());return this._area=t,this},_in:function(t){return"string"!=typeof t&&(t=n.stringify(t)),this._ns?this._ns+t:t},_out:function(t){return this._ns?t&&0===t.indexOf(this._ns)?t.substring(this._ns.length):void 0:t}},storageAPI:{length:0,has:function(t){return this.items.hasOwnProperty(t)},key:function(t){var e=0;for(var n in this.items)if(this.has(n)&&t===e++)return n},setItem:function(t,e){this.has(t)||this.length++,this.items[t]=e},removeItem:function(t){this.has(t)&&(delete this.items[t],this.length--)},getItem:function(t){return this.has(t)?this.items[t]:null},clear:function(){for(var t in this.list)this.removeItem(t)},toString:function(){return this.length+" items in "+this.name+"Storage"}}};t.store&&(n.conflict=t.store);var i=n.Store("local",function(){try{return localStorage}catch(t){}}());i.local=i,i._=n,i.area("session",function(){try{return sessionStorage}catch(t){}}()),t.store=i,"function"==typeof e&&void 0!==e.amd?e(function(){return i}):"undefined"!=typeof module&&module.exports&&(module.exports=i)})(this,this.define); | ||
!function(a,b){var c={version:"2.3.1",areas:{},apis:{},inherit:function(a,b){for(var c in a)b.hasOwnProperty(c)||(b[c]=a[c]);return b},stringify:function(a){return void 0===a||"function"==typeof a?a+"":JSON.stringify(a)},parse:function(a){try{return JSON.parse(a)}catch(b){return a}},fn:function(a,b){c.storeAPI[a]=b;for(var d in c.apis)c.apis[d][a]=b},get:function(a,b){return a.getItem(b)},set:function(a,b,c){a.setItem(b,c)},remove:function(a,b){a.removeItem(b)},key:function(a,b){return a.key(b)},length:function(a){return a.length},clear:function(a){a.clear()},Store:function(a,b,d){var e=c.inherit(c.storeAPI,function(a,b,c){return 0===arguments.length?e.getAll():void 0!==b?e.set(a,b,c):"string"==typeof a||"number"==typeof a?e.get(a):a?e.setAll(a,b):e.clear()});e._id=a;try{var f="_safariPrivate_";b.setItem(f,"sucks"),e._area=b,b.removeItem(f)}catch(g){}return e._area||(e._area=c.inherit(c.storageAPI,{items:{},name:"fake"})),e._ns=d||"",c.areas[a]||(c.areas[a]=e._area),c.apis[e._ns+e._id]||(c.apis[e._ns+e._id]=e),e},storeAPI:{area:function(a,b){var d=this[a];return d&&d.area||(d=c.Store(a,b,this._ns),this[a]||(this[a]=d)),d},namespace:function(a,b){if(!a)return this._ns?this._ns.substring(0,this._ns.length-1):"";var d=a,e=this[d];return e&&e.namespace||(e=c.Store(this._id,this._area,this._ns+d+"."),this[d]||(this[d]=e),b||e.area("session",c.areas.session)),e},isFake:function(){return"fake"===this._area.name},toString:function(){return"store"+(this._ns?"."+this.namespace():"")+"["+this._id+"]"},has:function(a){return this._area.has?this._area.has(this._in(a)):!!(this._in(a)in this._area)},size:function(){return this.keys().length},each:function(a,b){for(var d=0,e=c.length(this._area);e>d;d++){var f=this._out(c.key(this._area,d));if(void 0!==f&&a.call(this,f,b||this.get(f))===!1)break;e>c.length(this._area)&&(e--,d--)}return b||this},keys:function(){return this.each(function(a,b){b.push(a)},[])},get:function(a,b){var d=c.get(this._area,this._in(a));return null!==d?c.parse(d):b||d},getAll:function(){return this.each(function(a,b){b[a]=this.get(a)},{})},set:function(a,b,d){var e=this.get(a);return null!=e&&d===!1?b:c.set(this._area,this._in(a),c.stringify(b),d)||e},setAll:function(a,b){var c,d;for(var e in a)d=a[e],this.set(e,d,b)!==d&&(c=!0);return c},remove:function(a){var b=this.get(a);return c.remove(this._area,this._in(a)),b},clear:function(){return this._ns?this.each(function(a){c.remove(this._area,this._in(a))},1):c.clear(this._area),this},clearAll:function(){var a=this._area;for(var b in c.areas)c.areas.hasOwnProperty(b)&&(this._area=c.areas[b],this.clear());return this._area=a,this},_in:function(a){return"string"!=typeof a&&(a=c.stringify(a)),this._ns?this._ns+a:a},_out:function(a){return this._ns?a&&0===a.indexOf(this._ns)?a.substring(this._ns.length):void 0:a}},storageAPI:{length:0,has:function(a){return this.items.hasOwnProperty(a)},key:function(a){var b=0;for(var c in this.items)if(this.has(c)&&a===b++)return c},setItem:function(a,b){this.has(a)||this.length++,this.items[a]=b},removeItem:function(a){this.has(a)&&(delete this.items[a],this.length--)},getItem:function(a){return this.has(a)?this.items[a]:null},clear:function(){for(var a in this.list)this.removeItem(a)},toString:function(){return this.length+" items in "+this.name+"Storage"}}};a.store&&(c.conflict=a.store);var d=c.Store("local",function(){try{return localStorage}catch(a){}}());d.local=d,d._=c,d.area("session",function(){try{return sessionStorage}catch(a){}}()),a.store=d,"function"==typeof b&&void 0!==b.amd?b(function(){return d}):"undefined"!=typeof module&&module.exports&&(module.exports=d)}(this,this.define); | ||
//# sourceMappingURL=store2.min.js.map |
{ | ||
"name": "store2", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "Better localStorage", | ||
@@ -54,7 +54,8 @@ "keywords": [ | ||
"grunt-contrib-qunit": "~0.2.0", | ||
"grunt-contrib-uglify": "~0.1.1", | ||
"grunt-contrib-uglify": "~0.10.0", | ||
"grunt-contrib-watch": "~0.3.1", | ||
"grunt-lib-phantomjs": "^0.7.0", | ||
"grunt-nuget": "^0.1.4", | ||
"phantomjs": "~1.9.0" | ||
} | ||
} |
@@ -83,3 +83,3 @@ A feature-filled and friendly way to take advantage of localStorage and sessionStorage | ||
but data stored will NOT persist beyond the life of the current document/page. Use the | ||
[store.old.js][old] extension to add persistent backing for the store API in older browsers. | ||
[store.old.js][old] extension to add persistent backing for the store API in ancient browsers. | ||
@@ -91,3 +91,3 @@ ## Extensions | ||
#### Beta - Stable and definitely useful | ||
* [store.old.js][old] - Add working localStorage and sessionStorage polyfills for older browsers | ||
* [store.old.js][old] - Add working localStorage and sessionStorage polyfills for ancient browsers | ||
* [store.overflow.js][overflow] - Fall back to fake storage on quota errors (e.g. very useful for [Safari private mode][safari]) | ||
@@ -120,3 +120,3 @@ * [store.cache.js][cache] - To make data expire, pass a number of seconds as the overwrite (third) param on ```set()``` calls | ||
* 2013-09-08 [v2.1.3][] (public) - Remove unnecessary component.js shim | ||
* 2014-03-01 [v2.1.4][] (public) - Package definition and store.overlow.js updates | ||
* 2014-03-01 [v2.1.4][] (public) - Package definition and store.overflow.js updates | ||
* 2014-03-06 [v2.1.5][] (public) - AMD support and Component improvements | ||
@@ -128,2 +128,3 @@ * 2014-03-10 [v2.1.6][] (public) - Fix AMD support flaw | ||
* 2015-05-22 [v2.3.0][] (public) - Use fake storage for Safari private mode (instead of letting quota exceptions go) | ||
* 2015-05-22 [v2.3.1][] (public) - Add source map | ||
@@ -142,2 +143,3 @@ [v2.0.3]: https://github.com/nbubna/store/tree/2.0.3 | ||
[v2.3.0]: https://github.com/nbubna/store/tree/2.3.0 | ||
[v2.3.1]: https://github.com/nbubna/store/tree/2.3.1 | ||
@@ -144,0 +146,0 @@ ## Store vs Store |
@@ -49,3 +49,3 @@ /** | ||
if (data !== undefined){ return store.set(key, data, overwrite); } | ||
if (typeof key === "string"){ return store.get(key); } | ||
if (typeof key === "string" || typeof key === "number"){ return store.get(key); } | ||
if (!key){ return store.clear(); } | ||
@@ -52,0 +52,0 @@ return store.setAll(key, data);// overwrite=data, data=key |
86936
16
1872
157
12