January 2020
Intermediate to advanced
470 pages
11h 13m
English
12.1. Maybe tasks? The following code shows a simpler solution than the one we looked at in question 8.2:
const pending = Maybe.of(listOfTasks) .map(getField("byPerson")) .map(filter(t => t.responsible === name)) .map(t => tasks) .map(t => t[0]) .map(filter(t => !t.done)) .map(getField("id")) .valueOf();
Here, we apply one function after the other, secure in the knowledge that if any of these functions produces an empty result (or even if the original listOfTasks is null), the sequence of calls will go on. In the end, you will either get an array of task IDs or a null value.
12.2. Extending your trees: Calculating the tree's height is simple if you do this in a recursive fashion. ...
Read now
Unlock full access