Skip to content

Commit

Permalink
feat: the partialState field is not required
Browse files Browse the repository at this point in the history
  • Loading branch information
imtaotao committed Nov 28, 2019
1 parent 6caae23 commit a8be4fe
Show file tree
Hide file tree
Showing 10 changed files with 576 additions and 590 deletions.
9 changes: 4 additions & 5 deletions demo/store/mpstore.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mpstore.js v0.1.7
* Mpstore.js v0.1.8
* (c) 2019-2019 Imtaotao
* Released under the MIT License.
*/
Expand Down Expand Up @@ -774,8 +774,7 @@ function assertReducer(action, reducer) {
var setter = reducer.setter,
partialState = reducer.partialState;
var stringifyAction = action.toString();
assert('partialState' in reducer, "You must defined [partialState]." + "\n\n --- from [".concat(stringifyAction, "] action."));
assert(isPlainObject(partialState), "The [partialState] must be an object." + "\n\n --- from [".concat(stringifyAction, "] action."));
assert(!('partialState' in reducer && !isPlainObject(partialState)), "The [partialState] must be an object." + "\n\n --- from [".concat(stringifyAction, "] action."));

if (typeof setter !== 'function') {
reducer.setter = function () {
Expand Down Expand Up @@ -817,7 +816,7 @@ function () {
this.depComponents = [];
this.GLOBALWORD = 'global';
this.isDispatching = false;
this.version = '0.1.7';
this.version = '0.1.8';
this.state = Object.freeze(createModule({}));
this.middleware = new Middleware(this);
}
Expand Down Expand Up @@ -1081,7 +1080,7 @@ function () {
return Store;
}();

var version = '0.1.7';
var version = '0.1.8';
var nativePage = Page;
var nativeComponent = Component;

Expand Down
9 changes: 4 additions & 5 deletions dist/mpstore.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mpstore.js v0.1.7
* Mpstore.js v0.1.8
* (c) 2019-2019 Imtaotao
* Released under the MIT License.
*/
Expand Down Expand Up @@ -778,8 +778,7 @@ function assertReducer(action, reducer) {
var setter = reducer.setter,
partialState = reducer.partialState;
var stringifyAction = action.toString();
assert('partialState' in reducer, "You must defined [partialState]." + "\n\n --- from [".concat(stringifyAction, "] action."));
assert(isPlainObject(partialState), "The [partialState] must be an object." + "\n\n --- from [".concat(stringifyAction, "] action."));
assert(!('partialState' in reducer && !isPlainObject(partialState)), "The [partialState] must be an object." + "\n\n --- from [".concat(stringifyAction, "] action."));

if (typeof setter !== 'function') {
reducer.setter = function () {
Expand Down Expand Up @@ -821,7 +820,7 @@ function () {
this.depComponents = [];
this.GLOBALWORD = 'global';
this.isDispatching = false;
this.version = '0.1.7';
this.version = '0.1.8';
this.state = Object.freeze(createModule({}));
this.middleware = new Middleware(this);
}
Expand Down Expand Up @@ -1085,7 +1084,7 @@ function () {
return Store;
}();

var version = '0.1.7';
var version = '0.1.8';
var nativePage = Page;
var nativeComponent = Component;

Expand Down
13 changes: 4 additions & 9 deletions dist/mpstore.es6m.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mpstore.js v0.1.7
* Mpstore.js v0.1.8
* (c) 2019-2019 Imtaotao
* Released under the MIT License.
*/
Expand Down Expand Up @@ -595,12 +595,7 @@ function assertReducer (action, reducer) {
const { setter, partialState } = reducer;
const stringifyAction = action.toString();
assert(
'partialState' in reducer,
`You must defined [partialState].` +
`\n\n --- from [${stringifyAction}] action.`,
);
assert(
isPlainObject(partialState),
!('partialState' in reducer && !isPlainObject(partialState)),
`The [partialState] must be an object.` +
`\n\n --- from [${stringifyAction}] action.`,
);
Expand Down Expand Up @@ -650,7 +645,7 @@ class Store {
this.depComponents = [];
this.GLOBALWORD = 'global';
this.isDispatching = false;
this.version = '0.1.7';
this.version = '0.1.8';
this.state = Object.freeze(createModule({}));
this.middleware = new Middleware(this);
}
Expand Down Expand Up @@ -891,7 +886,7 @@ class Store {
}
}

const version = '0.1.7';
const version = '0.1.8';
const nativePage = Page;
const nativeComponent = Component;
function expandConfig (config, expandMethods, isPage) {
Expand Down
9 changes: 4 additions & 5 deletions dist/mpstore.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mpstore.js v0.1.7
* Mpstore.js v0.1.8
* (c) 2019-2019 Imtaotao
* Released under the MIT License.
*/
Expand Down Expand Up @@ -774,8 +774,7 @@ function assertReducer(action, reducer) {
var setter = reducer.setter,
partialState = reducer.partialState;
var stringifyAction = action.toString();
assert('partialState' in reducer, "You must defined [partialState]." + "\n\n --- from [".concat(stringifyAction, "] action."));
assert(isPlainObject(partialState), "The [partialState] must be an object." + "\n\n --- from [".concat(stringifyAction, "] action."));
assert(!('partialState' in reducer && !isPlainObject(partialState)), "The [partialState] must be an object." + "\n\n --- from [".concat(stringifyAction, "] action."));

if (typeof setter !== 'function') {
reducer.setter = function () {
Expand Down Expand Up @@ -817,7 +816,7 @@ function () {
this.depComponents = [];
this.GLOBALWORD = 'global';
this.isDispatching = false;
this.version = '0.1.7';
this.version = '0.1.8';
this.state = Object.freeze(createModule({}));
this.middleware = new Middleware(this);
}
Expand Down Expand Up @@ -1081,7 +1080,7 @@ function () {
return Store;
}();

var version = '0.1.7';
var version = '0.1.8';
var nativePage = Page;
var nativeComponent = Component;

Expand Down
Loading

0 comments on commit a8be4fe

Please sign in to comment.