Comparing version 2.5.0 to 2.5.1
@@ -200,7 +200,7 @@ ;(function(){ | ||
require.register("store/dist/store2.js", function(exports, require, module){ | ||
/*! store2 - v2.5.0 - 2017-01-09 | ||
* Copyright (c) 2017 Nathan Bubna; Licensed MIT, GPL */ | ||
/*! store2 - v2.5.1 - 2017-03-28 | ||
* Copyright (c) 2017 Nathan Bubna; Licensed , */ | ||
;(function(window, define) { | ||
var _ = { | ||
version: "2.5.0", | ||
version: "2.5.1", | ||
areas: {}, | ||
@@ -607,2 +607,9 @@ apis: {}, | ||
function put(area, s) { | ||
try { | ||
area.setItem("__test__", s); | ||
return true; | ||
} catch (e) {} | ||
} | ||
_.fn('remainingSpace', function() { | ||
@@ -644,9 +651,2 @@ return this._area.remainingSpace; | ||
function put(area, s) { | ||
try { | ||
area.setItem("__test__", s); | ||
return true; | ||
} catch (e) {} | ||
} | ||
})(window.store, window.store._); | ||
@@ -670,2 +670,10 @@ }); | ||
function addUpdateFn(area, name, update) { | ||
var old = area[name]; | ||
area[name] = function() { | ||
var ret = old.apply(this, arguments); | ||
update.apply(this, arguments); | ||
return ret; | ||
}; | ||
} | ||
function create(name, items, update) { | ||
@@ -685,10 +693,2 @@ var length = 0; | ||
} | ||
function addUpdateFn(area, name, update) { | ||
var old = area[name]; | ||
area[name] = function() { | ||
var ret = old.apply(this, arguments); | ||
update.apply(this, arguments); | ||
return ret; | ||
}; | ||
} | ||
@@ -695,0 +695,0 @@ if (store.isFake()) { |
@@ -1,6 +0,6 @@ | ||
/*! store2 - v2.5.0 - 2017-01-09 | ||
* Copyright (c) 2017 Nathan Bubna; Licensed MIT, GPL */ | ||
/*! store2 - v2.5.1 - 2017-03-28 | ||
* Copyright (c) 2017 Nathan Bubna; Licensed , */ | ||
;(function(window, define) { | ||
var _ = { | ||
version: "2.5.0", | ||
version: "2.5.1", | ||
areas: {}, | ||
@@ -7,0 +7,0 @@ apis: {}, |
@@ -1,5 +0,5 @@ | ||
/*! store2 - v2.5.0 - 2017-01-09 | ||
* Copyright (c) 2017 Nathan Bubna; Licensed MIT, GPL */ | ||
/*! store2 - v2.5.1 - 2017-03-28 | ||
* Copyright (c) 2017 Nathan Bubna; Licensed , */ | ||
!function(a,b){var c={version:"2.5.0",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():"function"==typeof b?e.transact(a,b,c):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)},{})},transact:function(a,b,c){var d=this.get(a,c),e=b(d);return this.set(a,void 0===e?d:e),this},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"}}},d=c.Store("local",function(){try{return localStorage}catch(a){}}());d.local=d,d._=c,d.area("session",function(){try{return sessionStorage}catch(a){}}()),"function"==typeof b&&void 0!==b.amd?b("store2",[],function(){return d}):"undefined"!=typeof module&&module.exports?module.exports=d:(a.store&&(c.conflict=a.store),a.store=d)}(this,this.define); | ||
!function(a,b){var c={version:"2.5.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():"function"==typeof b?e.transact(a,b,c):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{b.setItem("_safariPrivate_","sucks"),e._area=b,b.removeItem("_safariPrivate_")}catch(a){}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);d<e;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)},{})},transact:function(a,b,c){var d=this.get(a,c),e=b(d);return this.set(a,void 0===e?d:e),this},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"}}},d=c.Store("local",function(){try{return localStorage}catch(a){}}());d.local=d,d._=c,d.area("session",function(){try{return sessionStorage}catch(a){}}()),"function"==typeof b&&void 0!==b.amd?b("store2",[],function(){return d}):"undefined"!=typeof module&&module.exports?module.exports=d:(a.store&&(c.conflict=a.store),a.store=d)}(this,this.define); | ||
//# sourceMappingURL=store2.min.js.map |
{ | ||
"name": "store2", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Better localStorage", | ||
@@ -47,15 +47,15 @@ "keywords": [ | ||
"devDependencies": { | ||
"grunt": "~0.4.1", | ||
"grunt-cli": "^0.1", | ||
"grunt": "^1.0.1", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-component-build": "~0.2.7", | ||
"grunt-contrib-clean": "~0.4.0", | ||
"grunt-contrib-concat": "~0.1.3", | ||
"grunt-contrib-jshint": "~0.1.1", | ||
"grunt-contrib-qunit": "~0.2.0", | ||
"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" | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-concat": "^1.0.1", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-contrib-qunit": "^0.2.2", | ||
"grunt-contrib-uglify": "^2.2.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-lib-phantomjs": "^1.1.0", | ||
"grunt-nuget": "^0.2.0", | ||
"phantomjs": "^2.1.7" | ||
} | ||
} |
A feature-filled and friendly way to take advantage of localStorage and sessionStorage | ||
(JSON, namespacing, extensions, etc). | ||
Download: [store2.min.js][prod] or [store2.js][dev] [![Build Status](https://travis-ci.org/nbubna/store.png?branch=master)](https://travis-ci.org/nbubna/store) | ||
Download: [store2.min.js][prod] or [store2.js][dev] | ||
[NPM][npm]: `npm install store2` | ||
@@ -14,5 +14,8 @@ Bower: `bower install store2` | ||
[![Build Status](https://travis-ci.org/nbubna/store.png?branch=master)](https://travis-ci.org/nbubna/store) | ||
[![npm version](https://badge.fury.io/js/store2.svg)](https://badge.fury.io/js/store2) | ||
[![npm](https://img.shields.io/npm/dm/store2.svg?maxAge=2592000)](https://www.npmjs.com/package/store2) | ||
## Documentation | ||
The main store function can handle ```set```, ```get```, ```setAll```, ```getAll``` and ```clear``` | ||
The main store function can handle ```set```, ```get```, ```transact```, ```setAll```, ```getAll``` and ```clear``` | ||
actions directly. Respectively, these are called like so: | ||
@@ -51,2 +54,12 @@ | ||
Functions passed to ```transact``` will receive the current value for that key as an argument or | ||
a passed alternate if there is none. When the passed function is completed, transact will save the returned value | ||
under the specified key. If the function returns ```undefined```, the original value will be saved. | ||
This makes it easy for transact functions to change internal properties in a persistent way: | ||
```javascript | ||
store.transact(key, function(obj) { | ||
obj.changed = 'newValue';// this change will be persisted | ||
}); | ||
``` | ||
All of these use the browser's localStorage (aka "local"). Using sessionStorage merely requires | ||
@@ -102,2 +115,3 @@ calling the same functions on ```store.session```: | ||
* [store.array.js][array] - Easy, powerful array functions for any and all data (e.g. ```store.push(key, v1, v2)```). | ||
* [store.dom.js][dom] - Declarative, persistent DOM element content via store. | ||
@@ -122,2 +136,3 @@ #### Alpha - Either incomplete or unstable or both | ||
[deep]: https://raw.github.com/nbubna/store/master/src/store.deep.js | ||
[dom]: https://raw.github.com/nbubna/store/master/src/store.dom.js | ||
[safari]: https://github.com/marcuswestin/store.js/issues/66 | ||
@@ -143,2 +158,3 @@ | ||
* 2017-01-09 [v2.5.0][] (public) - Update for issue #34; new extensions (array, dot, and deep); only expose global in non-AMD/CommonJS environments (PR #35) | ||
* 2017-03-28 [v2.5.1][] (public) - Lint fixes, dependency updates | ||
@@ -160,2 +176,3 @@ [v2.0.3]: https://github.com/nbubna/store/tree/2.0.3 | ||
[v2.5.0]: https://github.com/nbubna/store/tree/2.5.0 | ||
[v2.5.1]: https://github.com/nbubna/store/tree/2.5.1 | ||
@@ -162,0 +179,0 @@ ## Store vs Store |
@@ -18,2 +18,9 @@ /** | ||
function put(area, s) { | ||
try { | ||
area.setItem("__test__", s); | ||
return true; | ||
} catch (e) {} | ||
} | ||
_.fn('remainingSpace', function() { | ||
@@ -55,9 +62,2 @@ return this._area.remainingSpace; | ||
function put(area, s) { | ||
try { | ||
area.setItem("__test__", s); | ||
return true; | ||
} catch (e) {} | ||
} | ||
})(window.store, window.store._); |
@@ -16,2 +16,10 @@ /** | ||
function addUpdateFn(area, name, update) { | ||
var old = area[name]; | ||
area[name] = function() { | ||
var ret = old.apply(this, arguments); | ||
update.apply(this, arguments); | ||
return ret; | ||
}; | ||
} | ||
function create(name, items, update) { | ||
@@ -31,10 +39,2 @@ var length = 0; | ||
} | ||
function addUpdateFn(area, name, update) { | ||
var old = area[name]; | ||
area[name] = function() { | ||
var ret = old.apply(this, arguments); | ||
update.apply(this, arguments); | ||
return ret; | ||
}; | ||
} | ||
@@ -41,0 +41,0 @@ if (store.isFake()) { |
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
97928
20
2091
189