You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The path reducer allows us to get a specific path from an input object, but at times we want to manipulate the object afterward, because of the nature of reducers being async, adding multiple reducers could not be the most optimal.
['$sone.path.here',syncMethod]
Suggested solution:
Create a higher order function reducer that will output a reducer that executes a given method with its input being the result of a lookup on an Object's path:
// over simplified:consttoReducerFromPath=(method)=>(valuePath,defaultValue)=>(value)=>method(get(valuePath,defaultValue))
// So instead of this: dataPoint.resolve(['$some.path.zipCode',_.toInteger],input)// To this: consttoIntegerFromPath=toReducerFromPath(_.toInteger)dataPoint.resolve(toIntegerFromPath('$some.path.zipCode'),input)
is toPathReducer the best name?
AC:
This method could be exposed under require(data-point/helpers)
if no valuePath is received then execute the method against the reducer's value
should use same path parser the pathReducer uses
The text was updated successfully, but these errors were encountered:
acatl
changed the title
Add toPathReducer as a helper function
Add toReducerFromPath as a helper function
Dec 13, 2018
Problem description:
The path reducer allows us to get a specific path from an input object, but at times we want to manipulate the object afterward, because of the nature of reducers being async, adding multiple reducers could not be the most optimal.
Suggested solution:
Create a higher order function reducer that will output a reducer that executes a given method with its input being the result of a lookup on an Object's path:
is toPathReducer the best name?
AC:
require(data-point/helpers)
The text was updated successfully, but these errors were encountered: