3 ms·
It's really nice for when you have to do operations where you want a "tuple" in Javascript. Consider the case of finding all companies along with their hires f
by ubertaco 10y ago
It's really nice for when you have to do operations where you want a "tuple" in Javascript.
Consider the case of finding all companies along with their hires from the last week, but only if the company has a hire from the last week:
companies.map(c => [c, employeeStorage.getEmployees(c)])
.map(([company, employees]) => [company, employees.filter(e => e.hireDate > aWeekAgo)])
.filter(([company, employees]) => employees.length > 0)