Recursively iterate through arrays with Lodash <p>I want to use underscore to go iterate each item and append a period to the end of each fruit's name, and return an array. But there can be many nested levels. </p> <p><code>const</code> <code>NESTED =</code> <code>[ {name: 'Apple', items: [{ name: 'Orange', items: [{name: 'Banana'}] }]}, {name: 'Pear'}]</code></p> <p>My final should look like this:</p> <p><code>NESTED =</code> <code>[{ name: 'Apple.', items: [{name: 'Orange.', items: [{name: 'Banana.'}]}]}, { name: 'Pear.'}]</code></p> <p>There can be many and many items within. This is where I am stuck, my current underscore function only gets the first level, using ._map:</p> <pre><code>let items = _.map(NESTED, function(item){ return { // append the period here, but doesn't go deeper } }); </code></pre> <p>What is a good way to do this?</p>