Pipeline breaking with error, possible use of '?' symbol ? #3300
adellamaggiora
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I would like to know how to make a check inside the pipelines to avoid the process to throw exception.
For example:
const isTypeDensity = R.propEq('type', 'density');
const getDensity = R.pipe(R.find(isTypeDensity), R.pick(['value', 'error', 'measureUnit']));
when I pass a null argument to getDenisty it will throw an error but also if I pass an empty array (or an array with all alements that don't match the predicate) will throw an error because R.pick will take a null value. How can i fix this issue?
with vanilla javascript I can easily do with something like this:
myArray?.find()?. etc..
thank you for the help.
Beta Was this translation helpful? Give feedback.
All reactions