I want to have a pipe that does some operations on a Maybe, and want to return its value at last. Currently I am doing:
const data = Maybe(5)
pipe(
map(add(1)),
... other operations
y => y.getOrElse([])
)(data)
Is there any cleaner way out?
唯一的改进是创建一个无点辅助函数
const getOrElse = (defaultValue) => (m) => m.getOrElse(defaultValue);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.