So with that ... the code would be somehtng like this, for the example you and I used first. RIght?
let whatHappened = conditionalReduce(body.type, { 'isBasic': () => { const entry = getBasicEntry(body.id); console.log(`Processing basic entry "${entry.name}"`); result doBasicProcessing(entry); }, 'isCustom': () => { const entry = getCustomEntry(body.id); console.log(`Processing custom entry "${entry.name}"`); return doCustomprocessing(entry); });
A few syntax issues aside, yes ;-)
It would look like:
let whatHappened = conditionalReduce(body.type, { 'isBasic': () => { const entry = getBasicEntry(body.id); console.log(`Processing basic entry "${entry.name}"`); return doBasicProcessing(entry); }, 'isCustom': () => { const entry = getCustomEntry(body.id); console.log(`Processing custom entry "${entry.name}"`); return doCustomprocessing(entry); } });
yeah, i figured the dev.to editor wouldn't protect me and that you'd forgive those mistakes :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
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.
So with that ... the code would be somehtng like this, for the example you and I used first. RIght?
A few syntax issues aside, yes ;-)
It would look like:
yeah, i figured the dev.to editor wouldn't protect me and that you'd forgive those mistakes :)