redux-zero
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -46,3 +46,5 @@ 'use strict'; | ||
setState: function (update) { | ||
state = __assign({}, state, update); | ||
state = | ||
typeof update === "function" | ||
? __assign({}, state, update(state)) : __assign({}, state, update); | ||
listeners.forEach(function (f) { return f(state); }); | ||
@@ -49,0 +51,0 @@ }, |
@@ -42,3 +42,5 @@ import { Children, Component, createElement } from 'react'; | ||
setState: function (update) { | ||
state = __assign({}, state, update); | ||
state = | ||
typeof update === "function" | ||
? __assign({}, state, update(state)) : __assign({}, state, update); | ||
listeners.forEach(function (f) { return f(state); }); | ||
@@ -45,0 +47,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t["redux-zero"]={},t.React)}(this,function(t,e){"use strict";function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function r(t,e){for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function o(t,e,n){return"object"==typeof t?null:new Error("Invalid prop "+e+" supplied to "+n)}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},s=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return n(r,t),r.prototype.getChildContext=function(){return{store:this.props.store}},r.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},r.childContextTypes={store:o},r}(e.Component);t.createStore=function(t){void 0===t&&(t={});var e=[];return{setState:function(n){t=u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){e.push(t)},unsubscribe:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},getState:function(){return t}}},t.connect=function(t){return function(i){return s=function(o){function s(){var t=null!==o&&o.apply(this,arguments)||this;return t.state=t.getProps(),t.update=function(){var e=t.getProps();r(e,t.state)||t.setState(e)},t}return n(s,o),s.prototype.componentWillMount=function(){this.context.store.subscribe(this.update)},s.prototype.componentWillUnmount=function(){this.context.store.unsubscribe(this.update)},s.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},s.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},s}(e.Component),s.contextTypes={store:o},s;var s}},t.Provider=s,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t["redux-zero"]={},t.React)}(this,function(t,e){"use strict";function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function r(t,e){for(var n in t)if(t[n]!==e[n])return!1;for(var n in e)if(!(n in t))return!1;return!0}function o(t,e,n){return"object"==typeof t?null:new Error("Invalid prop "+e+" supplied to "+n)}var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},c=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return n(r,t),r.prototype.getChildContext=function(){return{store:this.props.store}},r.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},r.childContextTypes={store:o},r}(e.Component);t.createStore=function(t){void 0===t&&(t={});var e=[];return{setState:function(n){t="function"==typeof n?u({},t,n(t)):u({},t,n),e.forEach(function(e){return e(t)})},subscribe:function(t){e.push(t)},unsubscribe:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},getState:function(){return t}}},t.connect=function(t){return function(i){return c=function(o){function c(){var t=null!==o&&o.apply(this,arguments)||this;return t.state=t.getProps(),t.update=function(){var e=t.getProps();r(e,t.state)||t.setState(e)},t}return n(c,o),c.prototype.componentWillMount=function(){this.context.store.subscribe(this.update)},c.prototype.componentWillUnmount=function(){this.context.store.unsubscribe(this.update)},c.prototype.getProps=function(){var e=this.context.store&&this.context.store.getState()||{};return t(e,this.props)},c.prototype.render=function(){return e.createElement(i,u({store:this.context.store},this.props,this.state))},c}(e.Component),c.contextTypes={store:o},c;var c}},t.Provider=c,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=redux-zero.min.js.map |
{ | ||
"name": "redux-zero", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "", | ||
@@ -17,5 +17,5 @@ "main": "dist/redux-zero.cjs.js", | ||
"prebuild": "npm run format && npm run check && npm run clean", | ||
"build:umd": "NODE_ENV=umd rollup --config", | ||
"build:cjs": "NODE_ENV=cjs rollup --config", | ||
"build:es": "NODE_ENV=es rollup --config", | ||
"build:umd": "cross-env NODE_ENV=umd rollup --config", | ||
"build:cjs": "cross-env NODE_ENV=cjs rollup --config", | ||
"build:es": "cross-env NODE_ENV=es rollup --config", | ||
"build": "npm run build:umd && npm run build:cjs && npm run build:es" | ||
@@ -50,2 +50,3 @@ }, | ||
"@types/react": "^16.0.9", | ||
"cross-env": "^5.0.5", | ||
"enzyme": "3.1.0", | ||
@@ -61,2 +62,3 @@ "enzyme-adapter-react-16": "1.0.1", | ||
"rollup-plugin-commonjs": "8.2.1", | ||
"rollup-plugin-filesize": "^1.4.2", | ||
"rollup-plugin-node-resolve": "3.0.0", | ||
@@ -63,0 +65,0 @@ "rollup-plugin-peer-deps-external": "1.0.0", |
@@ -142,3 +142,3 @@ <h1 align="center"> | ||
## Roadmap | ||
- Extract 'connect' so that Redux Zero can be use with multiple frameworks | ||
- Extract 'connect' so that Redux Zero can be used with multiple frameworks | ||
- Add more use case examples (including unit tests) | ||
@@ -145,0 +145,0 @@ |
@@ -5,2 +5,3 @@ import typescript from 'rollup-plugin-typescript2'; | ||
import uglify from 'rollup-plugin-uglify'; | ||
import filesize from 'rollup-plugin-filesize'; | ||
import peerDeps from 'rollup-plugin-peer-deps-external'; | ||
@@ -32,4 +33,4 @@ | ||
isUmd && config.plugins.push(uglify()); | ||
isUmd && config.plugins.push(uglify(), filesize()); | ||
export default config; |
@@ -5,5 +5,6 @@ export default function createStore(state = {}) { | ||
setState(update) { | ||
state = typeof update === "function" ? | ||
{ ...state, ...update(state) } : | ||
{ ...state, ...update } | ||
state = | ||
typeof update === "function" | ||
? { ...state, ...update(state) } | ||
: { ...state, ...update } | ||
@@ -10,0 +11,0 @@ listeners.forEach(f => f(state)) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
49930
36
645
19