title: Get object from json based on value using Lodash
body: <p>I have the following in json format</p>
  
  <pre><code>{
    "timings": {
      "a": "02:57",
      "b": "05:19",
      "c": "13:22",
      "d": "17:39",
      "e": "21:26",
      "f": "21:26",
      "g": "23:40",
      "h": "02:47",
      "i": "01:22"
    }
  }
  </code></pre>
  
  <p>Using lodash and momentjs, how I can pick the object whose value is same or after the current time.</p>
  
  <p>I have tried the following</p>
  
  <pre><code>let findTime = (times) =&gt; {
      const timeNow = moment();
      let nextEvent = null;
      lodash.find(times, function (value, key) {
          const thisTime = moment(value, 'HH:mm');
          if (thisTime.isSameOrAfter(timeNow, 'second')) {
              console.log(key + " is next");
              nextEvent = {
                  'name': key,
                  'time': value
              };
              return;
          }
      });
      return nextEvent;
  }
  </code></pre>
  
  <p>The problem is it keeps returning the item i no matter. I figured that the function find iterate over all the entries.</p>
  
  <p>I am unable to find a different solution.</p>
  
  <p>I need to maintain the order of the times.</p>
  
  <p>Any pointers...?</p>