Also a great idea. I added a new helper so that folks can do either. Thanks again, this makes things cleaner!
const{curry}=require('conditional-reduce');constdogReducer=curry({dog:()=>'Dogs are great pets',cat:()=>'Cat\'s are also great'});console.log(dogReducer('dog'));// Prints "Dogs are great pets"console.log(dogReducer('bird'));// Throws 'Invalid conditional value "bird"' exception
const{reduce}=require('conditional-reduce');console.log(reduce('dog',{dog:()=>'Dogs are great pets',cat:()=>'Cat\'s are also great'}));// Prints "Dogs are great pets"console.log(reduce('bird',{dog:()=>'Dogs are great pets',cat:()=>'Cat\'s are also great'}));// Throws 'Invalid conditional value "bird"' exception
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Also a great idea. I added a new helper so that folks can do either. Thanks again, this makes things cleaner!