jsdataframe.js
function reduceUnless(array, initValue, condFunc, func) {
  var result = initValue;
  for (var i = 0; i < array.length; i++) {
    var value = array[i];
    if (condFunc(value)) {
      return value;
    }
    result = func(result, value);
  }
  return result;
}
function reduceUnless(array, initValue, condFunc, func) {
  var result = initValue;
  for (var i = 0; i < array.length; i++) {
    var value = array[i];
    if (condFunc(value)) {
      return value;
    }
    result = func(result, value);
  }
  return result;
}
function reduceUnless ( array , initValue , condFunc , func ) { var result = initValue ; for ( var i = 0 ; i < array . length ; i ++ ) { var value = array [ i ] ; if ( condFunc ( value ) ) { return value ; } result = func ( result , value ) ; } return result ; }
Performs a left-to-right reduce on 'array' using 'func' starting with 'initValue' unless there's an element for which 'condFunc' returns truthy, in which case this element is immediately returned, halting the rest of the reduction.  For an empty array 'initValue' is immediaately returned.
Performs a left - to - right reduce on array using func starting with initValue unless there s an element for which condFunc returns truthy in which case this element is immediately returned halting the rest of the reduction . For an empty array initValue is immediaately returned .