Monads on the Cheap I: The Maybe Monad
Don’t worry, this isn’t YAMT (Yet Another Monad Tutorial ). This is a practical post about a code smell that afflicts everyday code, and about an idiom that eliminates that smell. It just so happens that this idiom corresponds to one of the uses for monads in Haskell, but that’s just theory behind the practice, and I’ve saved the theory for the end.
GitHub - tc39/proposal-optional-chaining
When looking for a property value that's deep in a tree-like structure, one often has to check whether intermediate nodes exist:var street = user.address && user.address.street;