compose-state
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,1 +0,1 @@ | ||
"use strict";var _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a};Object.defineProperty(exports,"__esModule",{value:!0});function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}var composeStateFactory=function(a){return function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];return c.map(function(a){return a instanceof Function?a:function(){return a}}).reduceRight(function(b,c){return function(){for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];var g=b.apply(void 0,e),h=c.apply(void 0,_toConsumableArray(e.slice(0,a)).concat([_extends({},e[a],g)],_toConsumableArray(e.slice(a+1))));return h?_extends({},e[a],g,h):null}},function(){return null})}},composeState=exports.composeState=composeStateFactory(0),composeDerivedStateFromProps=exports.composeDerivedStateFromProps=composeStateFactory(1);exports.default=composeState; | ||
"use strict";var _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a};Object.defineProperty(exports,"__esModule",{value:!0});function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}var composeStateFactory=function(a){return function(){for(var b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];return c.map(function(a){return a instanceof Function?a:function(){return a}}).reduceRight(function(b,c){return function(){for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];var g=b.apply(void 0,e),h=c.apply(void 0,_toConsumableArray(e.slice(0,a)).concat([_extends({},e[a],g)],_toConsumableArray(e.slice(a+1))));return h?_extends({},g,h):null}},function(){return null})}},composeState=exports.composeState=composeStateFactory(0),composeDerivedStateFromProps=exports.composeDerivedStateFromProps=composeStateFactory(1);exports.default=composeState; |
@@ -13,5 +13,3 @@ const composeStateFactory = stateIndex => (...updaters) => | ||
return currentState | ||
? { ...args[stateIndex], ...accumulatedState, ...currentState } | ||
: null; | ||
return currentState ? { ...accumulatedState, ...currentState } : null; | ||
}, | ||
@@ -18,0 +16,0 @@ () => null, |
{ | ||
"name": "compose-state", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "compose setState updaters", | ||
@@ -5,0 +5,0 @@ "main": "dist.js", |
@@ -223,2 +223,8 @@ import React, { Component } from "react"; | ||
}); | ||
setState({ | ||
name: "function of one state prop, function of other state prop", | ||
expected: { value: 2, otherValue: 2 }, | ||
updaters: [s => ({value: s.value + 1}), s => ({otherValue: s.otherValue + 1})], | ||
state: { value: 1, otherValue: 1 }, | ||
}); | ||
deriveState({ name: "no value", expected: {} }); | ||
@@ -225,0 +231,0 @@ deriveState({ |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
12550
6
280
1
78