It seems to looks better with Ramda, isn't it:
const data = [ { wrongName: 'Jason', level: 7, cool: true }, { wrongName: 'Blanche', level: 8, cool: false } ]; Maybe(data) .map(filter(propEq('cool', true))) .map(head) .map(prop('name')) .map(toUpper) .cata({ Just: console.log Nothing: () => console.log('No data available') })
PS: thanks a lot for the article
This isn't exactly the same because Ramdas prop() does not return a Maybe, so if that prop did not exist then ramda would return an undefined, which will cause problems down the line. Same with head()
prop()
head()
You are totally right. Sorry for my mistake.
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.
It seems to looks better with Ramda, isn't it:
PS: thanks a lot for the article
This isn't exactly the same because Ramdas
prop()
does not return a Maybe, so if that prop did not exist then ramda would return an undefined, which will cause problems down the line. Same withhead()
You are totally right. Sorry for my mistake.