September 2017
Intermediate to advanced
216 pages
6h 8m
English
The final piece of this logic puzzle involves gluing these AND/OR conditions together. Luckily, we've already built all of the infrastructure to do this. For example, if you want to compose a new function that checks for both hasEnough() and hasEverything(), you can do so as follows:
const hasBoth = every( hasEnough, hasEverything);
The hasBoth() function that we've just created will only return true if both hasEnough() and hasEverything() return true. Let's put this new function to work and tie this all together:
const logHasBoth = behavior(Map.of( true, () => console.log('yep, it has all of it'), false, () => console.log('nope')));const myMap6 = myMap1.merge(myMap4);const myMap7 = myMap1.merge(myMap5);console.log('myMap6', ...Read now
Unlock full access