Filtering selects the elements that satisfy a condition and returns them as a smaller subset of the original collection. The condition is a predicate function. section 3.3
Select valid people
An imperative loop checks each person and pushes valid values into a result array. Lodash expresses the same operation directly: `_(persons).filter(isValid).map(fullname);`. The filter keeps only values for which `isValid` returns true, while map transforms the survivors. section 3.3
Filter, transform, and combine
To find people born in 1903 and format their names, define `const bornIn1903 = person => person.birthYear === 1903;` and write `_(persons).filter(bornIn1903).map(fullname).join(' and ');`. The result is `John von Neumann and Alonzo Church`. section 3.3
Refactor sequential data cleanup
A loop that removes null values, normalizes names, removes duplicates, and sorts them becomes `_.chain(names).filter(isValid).map(s => s.replace(/_/, ' ')).uniq().map(_.startCase).sort().value();`. Each operation states one transformation in the data flow. section 3.4
const p1 = new Person('Haskell', 'Curry', '111-11-1111');
p1.address = new Address('US');
p1.birthYear = 1900;
const p2 = new Person('Barkley', 'Rosser', '222-22-2222');
p2.address = new Address('Greece');
p2.birthYear = 1907;
const p3 = new Person('John', 'von Neumann', '333-33-3333');
p3.address = new Address('Hungary');
p3.birthYear = 1903;
const p4 = new Person('Alonzo', 'Church', '444-44-4444');
p4.address = new Address('US');
p4.birthYear = 1903;
Use the person records to try predicates based on country, birth year, or missing values before chaining another transformation. section 3.3
































