code: function cumulativeReduce(array, naValue, func) {
    var skipMissing = false;
    if (isUndefined(func)) {
      func = naValue;
      skipMissing = true;
    }
  
    var outputLen = array.length;
    var result = allocArray(outputLen);
  
    var accumulatedVal = null;
    var foundNonMissing = false;
    for (var i = 0; i < outputLen; i++) {
      var currVal = array[i];
      if (isMissing(currVal)) {
        result[i] = currVal;
        if (!skipMissing) {
          // Fill the rest of the array with naValue and break;
          for (var j = i + 1; j < outputLen; j++) {
            result[j] = naValue;
          }
          break;
        }
      } else {
        accumulatedVal = foundNonMissing ?
          func(accumulatedVal, currVal) :
          currVal;
        foundNonMissing = true;
        result[i] = accumulatedVal;
      }
    }
    return result;
  }
docs: Applies the given 'func' to reduce each element in 'array', returning the cumulative results in a new array.  The 'naValue' argument is optional.  Any missing value will result in a corresponding missing element in the output, but if 'naValue' isn't specified, the 'func' reduction will still be carried out on subsequent non-missing elements.  On the other hand, if 'naValue' is supplied it will be used as the output value for all elements following the first missing value encountered.