🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

redux-zero

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-zero - npm Package Compare versions

Comparing version

to
4.5.0

16

CHANGELOG.md
# Changelog
### 4.5.0
- Adds Thennable actions. Now we can declare actions as so:
```js
const mapActions = ({ setState }) => ({
getTodos() {
setState({ loading: true });
return client.get("/todos")
.then(payload => ({ payload, loading: false }))
.catch(error => ({ error, loading: false }))
}
});
```
### 4.4.3

@@ -4,0 +20,0 @@

16

package.json
{
"name": "redux-zero",
"version": "4.4.3",
"version": "4.5.0",
"description": "",

@@ -37,16 +37,8 @@ "main": "dist/redux-zero.js",

"jest": {
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"setupFiles": [
"<rootDir>/config/testSetup.js"
],
"moduleFileExtensions": ["ts", "tsx", "js"],
"setupFiles": ["<rootDir>/config/testSetup.js"],
"transform": {
"^.+\\.(ts|tsx)$": "<rootDir>/config/preprocessor.js"
},
"testMatch": [
"<rootDir>/src/**/*.spec.(ts|tsx)"
]
"testMatch": ["<rootDir>/src/**/*.spec.(ts|tsx)"]
},

@@ -53,0 +45,0 @@ "devDependencies": {

@@ -52,2 +52,3 @@ 'use strict';

function bindActions(actions, store) {
actions = typeof actions === "function" ? actions(store) : actions;
var bound = {};

@@ -61,4 +62,7 @@ var _loop_1 = function (name_1) {

var ret = actions[name_1].apply(actions, [store.getState()].concat(args));
if (ret != null)
if (ret != null) {
if (ret.then)
return ret.then(store.setState);
store.setState(ret);
}
};

@@ -99,3 +103,3 @@ };

var actions = this.props.actions;
return bindActions(typeof actions === "function" ? actions(this.context.store) : actions, this.context.store);
return bindActions(actions, this.context.store);
};

@@ -102,0 +106,0 @@ Connect.prototype.render = function (_a, state, _b) {

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],e):e(t["redux-zero"]={},t.preact)}(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 o(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 r(t,e){var n={};for(var o in t)!function(o){n[o]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=t[o].apply(t,[e.getState()].concat(n));null!=i&&e.setState(i)}}(o);return 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])},s=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.state=e.getProps(),e.actions=e.getActions(),e.update=function(){var t=e.getProps();o(t,e.state)||e.setState(t)},e}return n(e,t),e.prototype.componentWillMount=function(){this.unsubscribe=this.context.store.subscribe(this.update)},e.prototype.componentWillUnmount=function(){this.unsubscribe(this.update)},e.prototype.getProps=function(){var t=this.props.mapToProps,e=this.context.store&&this.context.store.getState()||{};return t?t(e,this.props):e},e.prototype.getActions=function(){var t=this.props.actions;return r("function"==typeof t?t(this.context.store):t,this.context.store)},e.prototype.render=function(t,e,n){var o=t.children,r=n.store;return o[0](s({store:r},e,this.actions))},e}(e.Component),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getChildContext=function(){return{store:this.props.store}},e.prototype.render=function(){return this.props.children[0]},e}(e.Component);t.Provider=u,t.Connect=p,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],e):e(t["redux-zero"]={},t.preact)}(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 o(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 r(t,e){t="function"==typeof t?t(e):t;var n={};for(var o in t)!function(o){n[o]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=t[o].apply(t,[e.getState()].concat(n));if(null!=i){if(i.then)return i.then(e.setState);e.setState(i)}}}(o);return 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])},p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.state=e.getProps(),e.actions=e.getActions(),e.update=function(){var t=e.getProps();o(t,e.state)||e.setState(t)},e}return n(e,t),e.prototype.componentWillMount=function(){this.unsubscribe=this.context.store.subscribe(this.update)},e.prototype.componentWillUnmount=function(){this.unsubscribe(this.update)},e.prototype.getProps=function(){var t=this.props.mapToProps,e=this.context.store&&this.context.store.getState()||{};return t?t(e,this.props):e},e.prototype.getActions=function(){return r(this.props.actions,this.context.store)},e.prototype.render=function(t,e,n){var o=t.children,r=n.store;return o[0](p({store:r},e,this.actions))},e}(e.Component),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getChildContext=function(){return{store:this.props.store}},e.prototype.render=function(){return this.props.children[0]},e}(e.Component);t.Provider=u,t.Connect=s,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=index.min.js.map

@@ -59,2 +59,3 @@ 'use strict';

function bindActions(actions, store) {
actions = typeof actions === "function" ? actions(store) : actions;
var bound = {};

@@ -68,4 +69,7 @@ var _loop_1 = function (name_1) {

var ret = actions[name_1].apply(actions, [store.getState()].concat(args));
if (ret != null)
if (ret != null) {
if (ret.then)
return ret.then(store.setState);
store.setState(ret);
}
};

@@ -106,3 +110,3 @@ };

var actions = this.props.actions;
return bindActions(typeof actions === "function" ? actions(this.context.store) : actions, this.context.store);
return bindActions(actions, this.context.store);
};

@@ -109,0 +113,0 @@ Connect.prototype.render = function () {

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],n):n(t["redux-zero"]={},t.React)}(this,function(t,n){"use strict";function e(t,n){function e(){this.constructor=t}s(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function o(t,n){for(var e in t)if(t[e]!==n[e])return!1;for(var e in n)if(!(e in t))return!1;return!0}function r(t,n,e){return"object"==typeof t?null:new Error("Invalid prop "+n+" supplied to "+e)}function i(t,n){var e={};for(var o in t)!function(o){e[o]=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t[o].apply(t,[n.getState()].concat(e));null!=i&&n.setState(i)}}(o);return e}var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])},c=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++){n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.state=n.getProps(),n.actions=n.getActions(),n.update=function(){var t=n.getProps();o(t,n.state)||n.setState(t)},n}return e(n,t),n.prototype.componentWillMount=function(){this.unsubscribe=this.context.store.subscribe(this.update)},n.prototype.componentWillUnmount=function(){this.unsubscribe(this.update)},n.prototype.getProps=function(){var t=this.props.mapToProps,n=this.context.store&&this.context.store.getState()||{};return t?t(n,this.props):n},n.prototype.getActions=function(){var t=this.props.actions;return i("function"==typeof t?t(this.context.store):t,this.context.store)},n.prototype.render=function(){return this.props.children(c({store:this.context.store},this.state,this.actions))},n.contextTypes={store:r},n}(n.Component),u=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return e(o,t),o.prototype.getChildContext=function(){return{store:this.props.store}},o.prototype.render=function(){var t=this.props.children;return n.Children.only(t)},o.childContextTypes={store:r},o}(n.Component);t.connect=function(t,e){return void 0===e&&(e={}),function(o){return function(r){return n.createElement(p,{mapToProps:t,actions:e},function(t){return n.createElement(o,c({},t,r))})}}},t.Provider=u,t.Connect=p,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}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(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 r(t,e,n){return"object"==typeof t?null:new Error("Invalid prop "+e+" supplied to "+n)}function i(t,e){t="function"==typeof t?t(e):t;var n={};for(var o in t)!function(o){n[o]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=t[o].apply(t,[e.getState()].concat(n));if(null!=i){if(i.then)return i.then(e.setState);e.setState(i)}}}(o);return n}var s=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])},p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.state=e.getProps(),e.actions=e.getActions(),e.update=function(){var t=e.getProps();o(t,e.state)||e.setState(t)},e}return n(e,t),e.prototype.componentWillMount=function(){this.unsubscribe=this.context.store.subscribe(this.update)},e.prototype.componentWillUnmount=function(){this.unsubscribe(this.update)},e.prototype.getProps=function(){var t=this.props.mapToProps,e=this.context.store&&this.context.store.getState()||{};return t?t(e,this.props):e},e.prototype.getActions=function(){return i(this.props.actions,this.context.store)},e.prototype.render=function(){return this.props.children(p({store:this.context.store},this.state,this.actions))},e.contextTypes={store:r},e}(e.Component),c=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return n(o,t),o.prototype.getChildContext=function(){return{store:this.props.store}},o.prototype.render=function(){var t=this.props.children;return e.Children.only(t)},o.childContextTypes={store:r},o}(e.Component);t.connect=function(t,n){return void 0===n&&(n={}),function(o){return function(r){return e.createElement(u,{mapToProps:t,actions:n},function(t){return e.createElement(o,p({},t,r))})}}},t.Provider=c,t.Connect=u,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=index.min.js.map

@@ -37,2 +37,3 @@ 'use strict';

function bindActions(actions, store) {
actions = typeof actions === "function" ? actions(store) : actions;
var bound = {};

@@ -46,4 +47,7 @@ var _loop_1 = function (name_1) {

var ret = actions[name_1].apply(actions, [store.getState()].concat(args));
if (ret != null)
if (ret != null) {
if (ret.then)
return ret.then(store.setState);
store.setState(ret);
}
};

@@ -58,3 +62,3 @@ };

function getActions(store, actions) {
return bindActions(typeof actions === "function" ? actions(store) : actions, store);
return bindActions(actions, store);
}

@@ -61,0 +65,0 @@ function connect(component, store, mapToProps) {

@@ -1,2 +0,2 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n["redux-zero"]={})}(this,function(n){"use strict";function t(n,t){for(var e in n)if(n[e]!==t[e])return!1;for(var e in t)if(!(e in n))return!1;return!0}function e(n,e){return n!==e||!(!n||"object"!=typeof n)&&!t(n,e)}function r(n,t){var r={},o=!1;for(var f in n)e(t[f],n[f])&&(o=!0,r[f]=n[f]);return{diff:r,changed:o}}function o(n,t){var e={};for(var r in n)!function(r){e[r]=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var f=n[r].apply(n,[t.getState()].concat(e));null!=f&&t.setState(f)}}(r);return e}n.connect=function(n,t,e){function o(){var o=r(e(t.getState()),n.get()),f=o.diff;o.changed&&n.set(f)}o(),n.on("destroy",t.subscribe(o))},n.getActions=function(n,t){return o("function"==typeof t?t(n):t,n)},Object.defineProperty(n,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["redux-zero"]={})}(this,function(t){"use strict";function e(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 n(t,n){return t!==n||!(!t||"object"!=typeof t)&&!e(t,n)}function r(t,e){var r={},o=!1;for(var f in t)n(e[f],t[f])&&(o=!0,r[f]=t[f]);return{diff:r,changed:o}}function o(t,e){t="function"==typeof t?t(e):t;var n={};for(var r in t)!function(r){n[r]=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var f=t[r].apply(t,[e.getState()].concat(n));if(null!=f){if(f.then)return f.then(e.setState);e.setState(f)}}}(r);return n}t.connect=function(t,e,n){function o(){var o=r(n(e.getState()),t.get()),f=o.diff;o.changed&&t.set(f)}o(),t.on("destroy",e.subscribe(o))},t.getActions=function(t,e){return o(e,t)},Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=index.min.js.map

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

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