Reducing objects

In this section, we will turn our attention to reducing objects and working with object accumulators. Reducing objects is a lot like reducing arrays, the difference being that you have a key instead of an index. Oh yeah, there's also the ordering, which is kind of important—arrays are ordered, objects aren't.

Previously in the chapter, we caught a glimpse of what accumulators are. Here we'll take a deeper look at object accumulators, including some of the built-in Lo-Dash functions that utilize this concept.

Reducing keys

You can reduce an object to something different based solely on its keys. For example, if there are only certain properties you need, you can reduce the object to include only those properties, using the following ...

Get Lo-Dash Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.