title: Lodash Map only on a Condition
body: <p>I have a file called events.json which I require then use .map to create my object,</p>
  
  <pre><code>var data = require('./events.json')
  var newEventList = data.events.map(events =&gt; ({
      id: events.id ,
      name: events.name ,
      venue: events.venue.name
  }));
  </code></pre>
  
  <p>However, sometimes on occasion I get two event.ids which are identical. In these instances the map method creates a duplicate entry in my newEventList object. Can I set a conditional within the map function to skip the 'mapping' of that entry if the ids are identical? </p>
  
  <p>One thing to add is that the duplicates always are consecutive in the events.json so the If statement would only be comparing the previously mapped item.</p>
  
  <p>Thanks for your help.</p>