microcosm
Advanced tools
Comparing version 2.0.0 to 2.0.1
# Changelog | ||
### 2.0.1 | ||
- Fix issue where empty arguments would break deserialize | ||
### 2.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
module.exports=function(t){function r(e){if(n[e])return n[e].exports;var o=n[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var n={};return r.m=t,r.c=n,r.p="",r(0)}([function(t,r,n){"use strict";r.__esModule=!0;var e=n(7);r.tag=e,r["default"]=n(2)},function(t){"use strict";var r=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},n=function(){function t(){r(this,t),this._callbacks=[]}return t.prototype.ignore=function(t){this._callbacks=this._callbacks.filter(function(r){return r!==t})},t.prototype.listen=function(t){this._callbacks=this._callbacks.concat(t)},t.prototype.pump=function(){for(var t=0;t<this._callbacks.length;t++)this._callbacks[t].call(this)},t}();t.exports=n},function(t,r,n){"use strict";var e=function(t){return t&&t.__esModule?t["default"]:t},o=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(t.__proto__=r)},i=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},s=e(n(1)),u=e(n(3)),a=e(n(4)),c=e(n(5)),f=e(n(8)),p=e(n(6)),l=function(t){function r(){i(this,r),t.call(this),this._stores=[],this._state=this.getInitialState()}return o(r,t),r.prototype.getInitialState=function(){return{}},r.prototype.shouldUpdate=function(t,r){return 0==f(t,r)},r.prototype.seed=function(t){this.swap(this.deserialize(t))},r.prototype.has=function(){for(var t=this,r=arguments.length,n=Array(r),e=0;r>e;e++)n[e]=arguments[e];return n.some(function(r){return t._stores.some(function(t){return""+r==""+t})})},r.prototype.get=function(t){return this._state[t]},r.prototype.swap=function(t){this.shouldUpdate(this._state,t)&&(this._state=t,this.pump())},r.prototype.merge=function(t){this.swap(c(this._state,t))},r.prototype.prepare=function(t){for(var r,n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return(r=this.send).bind.apply(r,[this,t].concat(e))},r.prototype.send=function(t){for(var r=this,n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];var i=t.apply(this,e);return i instanceof Promise?i.then(function(n){return r.dispatch(t,n)}):this.dispatch(t,i)},r.prototype.dispatch=function(t,r){var n=this,e=this._stores.filter(function(r){return t in r}),o=p(e,function(e){return e[t](n.get(e),r)});return this.merge(o),r},r.prototype.addStore=function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];var e=r.map(function(t){return c(u,t)});a(!this.has(e),'A toString method within "'+r+'" is not unique'),this._stores=this._stores.concat(e),this.merge(p(e,function(t){return t.getInitialState()}))},r.prototype.serialize=function(){var t=this;return p(this._stores,function(r){return r.serialize(t.get(r))})},r.prototype.deserialize=function(t){return p(this._stores,function(r){return r.deserialize(t[r])})},r.prototype.toJSON=function(){return this.serialize()},r}(s);t.exports=l},function(t){"use strict";t.exports={getInitialState:function(){return void 0},serialize:function(t){return t},deserialize:function(){var t=void 0===arguments[0]?this.getInitialState():arguments[0];return t},toString:function(){throw new Error("Stores must implement a toString() method")}}},function(t){"use strict";function r(t,r){if(!t){var n=new Error(r);throw n.framesToPop=1,n}}t.exports=r},function(t){"use strict";function r(t,r){return n({},t,r)}var n=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t};t.exports=r},function(t){"use strict";function r(t,r){return t.reduce(function(t,n){return t[n]=r(n),t},{})}t.exports=r},function(t){"use strict";var r=0,n=function(t){return"function"==typeof t},e=function(t,n){var e=t.bind(null),o="_"+n+"_"+r++;return e.toString=function(){return o},e};t.exports=function(t){var r=Object.keys(t);return r.reduce(function(r,o){var i=t[o];return r[o]=n(i)?e(i,o):i,r},{})}},function(t,r,n){/*! | ||
module.exports=function(t){function r(e){if(n[e])return n[e].exports;var o=n[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var n={};return r.m=t,r.c=n,r.p="",r(0)}([function(t,r,n){"use strict";r.__esModule=!0;var e=n(7);r.tag=e,r["default"]=n(2)},function(t){"use strict";var r=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},n=function(){function t(){r(this,t),this._callbacks=[]}return t.prototype.ignore=function(t){this._callbacks=this._callbacks.filter(function(r){return r!==t})},t.prototype.listen=function(t){this._callbacks=this._callbacks.concat(t)},t.prototype.pump=function(){for(var t=0;t<this._callbacks.length;t++)this._callbacks[t].call(this)},t}();t.exports=n},function(t,r,n){"use strict";var e=function(t){return t&&t.__esModule?t["default"]:t},o=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(t.__proto__=r)},i=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},s=e(n(1)),u=e(n(3)),a=e(n(4)),c=e(n(5)),f=e(n(8)),p=e(n(6)),l=function(t){function r(){i(this,r),t.call(this),this._stores=[],this._state=this.getInitialState()}return o(r,t),r.prototype.getInitialState=function(){return{}},r.prototype.shouldUpdate=function(t,r){return 0==f(t,r)},r.prototype.seed=function(t){this.swap(this.deserialize(t))},r.prototype.has=function(){for(var t=this,r=arguments.length,n=Array(r),e=0;r>e;e++)n[e]=arguments[e];return n.some(function(r){return t._stores.some(function(t){return""+r==""+t})})},r.prototype.get=function(t){return this._state[t]},r.prototype.swap=function(t){this.shouldUpdate(this._state,t)&&(this._state=t,this.pump())},r.prototype.merge=function(t){this.swap(c(this._state,t))},r.prototype.prepare=function(t){for(var r,n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return(r=this.send).bind.apply(r,[this,t].concat(e))},r.prototype.send=function(t){for(var r=this,n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];var i=t.apply(this,e);return i instanceof Promise?i.then(function(n){return r.dispatch(t,n)}):this.dispatch(t,i)},r.prototype.dispatch=function(t,r){var n=this,e=this._stores.filter(function(r){return t in r}),o=p(e,function(e){return e[t](n.get(e),r)});return this.merge(o),r},r.prototype.addStore=function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];var e=r.map(function(t){return c(u,t)});a(!this.has(e),'A toString method within "'+r+'" is not unique'),this._stores=this._stores.concat(e),this.merge(p(e,function(t){return t.getInitialState()}))},r.prototype.serialize=function(){var t=this;return p(this._stores,function(r){return r.serialize(t.get(r))})},r.prototype.deserialize=function(){var t=void 0===arguments[0]?{}:arguments[0];return p(this._stores,function(r){return r.deserialize(t[r])})},r.prototype.toJSON=function(){return this.serialize()},r}(s);t.exports=l},function(t){"use strict";t.exports={getInitialState:function(){return void 0},serialize:function(t){return t},deserialize:function(){var t=void 0===arguments[0]?this.getInitialState():arguments[0];return t},toString:function(){throw new Error("Stores must implement a toString() method")}}},function(t){"use strict";function r(t,r){if(!t){var n=new Error(r);throw n.framesToPop=1,n}}t.exports=r},function(t){"use strict";function r(t,r){return n({},t,r)}var n=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t};t.exports=r},function(t){"use strict";function r(t,r){return t.reduce(function(t,n){return t[n]=r(n),t},{})}t.exports=r},function(t){"use strict";var r=0,n=function(t){return"function"==typeof t},e=function(t,n){var e=t.bind(null),o="_"+n+"_"+r++;return e.toString=function(){return o},e};t.exports=function(t){var r=Object.keys(t);return r.reduce(function(r,o){var i=t[o];return r[o]=n(i)?e(i,o):i,r},{})}},function(t,r,n){/*! | ||
* is-equal-shallow <https://github.com/jonschlinkert/is-equal-shallow> | ||
@@ -3,0 +3,0 @@ * |
{ | ||
"name": "microcosm", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "An experimental flux implimentation", | ||
@@ -46,4 +46,4 @@ "main": "dist/Microcosm.js", | ||
"raw-loader": "^0.5.1", | ||
"react": ">= 0.13.1", | ||
"react-hot-loader": "^1.2.4", | ||
"react": ">= 0.13.1", | ||
"react-tools": ">= 0.13.1", | ||
@@ -50,0 +50,0 @@ "route-recognizer": "^0.1.5", |
@@ -136,2 +136,10 @@ import Action from './fixtures/Action' | ||
it ('can handle undefined arguments in deserialize', function() { | ||
let m = new Microcosm() | ||
m.addStore({ toString() { return 'fiz' } }) | ||
m.deserialize() | ||
}) | ||
}) |
@@ -125,3 +125,3 @@ /** | ||
deserialize(data) { | ||
deserialize(data={}) { | ||
return mapBy(this._stores, store => store.deserialize(data[store])) | ||
@@ -128,0 +128,0 @@ } |
Sorry, the diff of this file is not supported yet
96128
1177