title: Underscore and LoDash _.each
body: <p>I'm in the process of migrating a code base from Underscore 1.8.2 to lodash 4.5.1. There was one test that failed after the migration.</p>
  
  <p>The code being tested was a recursive summation using <code>_.each</code>.</p>
  
  <pre><code>function foo(elements) {
    if (elements.isContainer()) {
      var sum = 0;
      _.each(elements, function(element) {
        sum += foo(element);
      });
      return sum;
    } else {
      return elements.someAttr ? 1 : 0;
    }
  }
  </code></pre>
  
  <p>Testing with an array that should be empty, <code>0</code> is expected as the result. <code>underscore.each</code> succeeded, but lodash did not (a positive value was returned).</p>
  
  <p>I replaced the <code>_.each(...</code> with <code>return _.sumBy(...</code>, and the tests passed, but I am concerned that there may be more dormant issues within the code base.</p>
  
  <p><strong>Any ideas as to which difference between the two libraries would cause this?</strong></p>