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
// with converge
const transformSuggestionsToOptions = converge(
([wordSuggestions, offerSuggestions]) =>
mapSuggestionsToOptions({ offerSuggestions, wordSuggestions }),
[extractWordSuggestions, extractOfferSuggestions]
);
// or with other mapSuggestionsToOptions signature (two params instead of one object param)
const transformSuggestionsToOptions = converge(
mapSuggestionsToOptions,
[extractWordSuggestions, extractOfferSuggestions]
);
`
Some points on this combinator https://jrsinclair.com/articles/2019/compose-js-functions-multiple-parameters/
I think, createSelector from 'reselect' has the same idea (but with memoization)
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In some cases i need converge function, f.e.
`
const extractOfferSuggestions = pathOr(["offerSuggestions"], []);
const extractWordSuggestions = pathOr(["wordSuggestions"], []);
const mapSuggestionsToOptions = (suggestions): SuggestOption[] => [];
// without converge
const transformSuggestionsToOptions = suggestions => {
const wordSuggestions = extractWordSuggestions(suggestions);
const offerSuggestions = extractOfferSuggestions(suggestions);
return mapSuggestionsToOptions({
offerSuggestions,
wordSuggestions
});
};
// with converge
const transformSuggestionsToOptions = converge(
([wordSuggestions, offerSuggestions]) =>
mapSuggestionsToOptions({ offerSuggestions, wordSuggestions }),
[extractWordSuggestions, extractOfferSuggestions]
);
// or with other mapSuggestionsToOptions signature (two params instead of one object param)
const transformSuggestionsToOptions = converge(
mapSuggestionsToOptions,
[extractWordSuggestions, extractOfferSuggestions]
);
`
Some points on this combinator https://jrsinclair.com/articles/2019/compose-js-functions-multiple-parameters/
I think, createSelector from 'reselect' has the same idea (but with memoization)
The text was updated successfully, but these errors were encountered: