Created
June 5, 2021 09:14
-
-
Save Parables/93e78f596429e7674d0e76cec070c758 to your computer and use it in GitHub Desktop.
Monads using null. Clever tricky by Nathan Franck http://disq.us/p/266tez0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getSupervisorName(enteredId: string | null) { | |
| let employee, supervisor; | |
| if (null != enteredId && | |
| null != (employee = repository.findById(parseInt(enteredId))) && | |
| null != employee.supervisorId && | |
| null != (supervisor = repository.findById(employee.supervisorId))) | |
| return supervisor.name; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment