3 ms·
Not everthing that can return null is a maybe function, sometimes you need a difference between zero and nothing. Solution3 for their example: function mayb
by croes 3y ago
Not everthing that can return null is a maybe function, sometimes you need a difference between zero and nothing.
Solution3 for their example:
function maybeRenderBestFriends() {
const user = maybeGetUser();
if(user!=null){
const friends = maybeGetFriends(user);
const bestFriends = maybeFilterBestFriends(friends);
return render(bestFriends);
}
return null;
}