September 2017
Intermediate to advanced
216 pages
6h 8m
English
You've seen how we can use maps to execute behavior based on a single value. Where this approach falls apart is when you get into more involved logic and/or conditions. However, you can still use Immutable.js collections to check declaratively for these types of conditions. For example, let's implement a function that will help us look for AND/OR conditions:
const some = (...predicates) => { const predicateSeq = Seq(predicates); return (...args) => predicateSeq.some(p => p(...args));};const every = (...predicates) => { const predicateSeq = Seq(predicates); return (...args) => predicateSeq.every(p => p(...args));};
The some() function is used to evaluate predicate functions in a logical OR fashion while the every() ...
Read now
Unlock full access