code: function lastEolBlock(str) {
      var n = str.length
      if (!n || str[--n] !== '\n') return -1  // set n = str.length-1, next while
      while (--n >= 0 && str[n] === '\n');    // starts with n>=0 and str[n]='\n'
      return n + 1
    }
docs: returns -1 if str has no eols at end, else the pos of fist eol in the block http://jsperf.com/jspreproc-find-last-non-eol