Mapping collections

In this section, we'll explore mapping collections. Mapping one collection to another ranges from composing simple—as we saw in the preceding section—to sophisticated callbacks. Callbacks that map each item in the collection can include or exclude properties and can calculate new values. We'll also address the issue of filtering collections and how this can be done in conjunction with mapping.

Including and excluding properties

When applied to an object, the pick() function generates a new object containing only the specified properties. The opposite function, omit(), generates an object with every property except those specified. Since these functions work fine for individual object instances, why not use them with a collection? ...

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.