lodash - How to _.trim an array of objects?
<p>I am trying to use lodash's <code>_.trim</code> to remove leading/trailing whitespace in the key/value like this:</p>

<pre><code>var items = [
             {"key": "  Needs Trim 1  ", "value": "  Needs Trim 2  "},
             {"key": "  Needs Trim 3  ", "value": " Needs Trim 4  "}
            ];
</code></pre>

<p>It should look like this after trimming with lodash:</p>

<pre><code>var items = [
             {"key": "Needs Trim 1", "value": "Needs Trim 2"},
             {"key": "Needs Trim 3", "value": "Needs Trim 4"}
            ];
</code></pre>

<p>I tried this:</p>

<pre><code>var trimmedItems = _.map(items, _.trim);
console.log(trimmedItems); // outputs ["[object Object]", "[object Object]"]
</code></pre>

<p>But I don't think that worked, as the <code>console.log(trimmedItems)</code> doesn't show the actual objects, so I am not sure if they are trimmed. Here is a <a href="https://jsfiddle.net/wboh4zcd/2/" rel="nofollow">fiddle</a> showing the issue, console should be open to see the issue as well.</p>

<p>Any idea how to get the fiddle to output the trimmed lodash objects to ensure they are trimmed correctly?</p>