Beispiel #1
0
function createSummaryInfo(bible) {
  var res = '';
  var prePadded = '      ';

  var tbs = 0; // total books count
  var tcs = 0; // total chapters count
  var tvs = 0; // total verses count

  _.each(lb.BBM.instance().ids(), function(n, id) {
    var b = bible.getBook(id);
    if (b === null) {
      return;
    }

    var nvs = 0;
    b.chapters.forEach(function(c) {
      nvs += c.numVerses();
    });

    res += _.padEnd(selectName(b.te.id), longestName, ' ') +
      _.padEnd(b.numChapters(), 6, ' ') +
      nvs + CRLF;

    tcs += b.numChapters();
    tvs += nvs;
    tbs++;
  });

  res += _.pad('', longestName + 11, '-') + CRLF +
    _.padEnd(tbs, longestName, ' ') +
    _.padEnd(tcs, 6, ' ') +
    tvs;
  return res;
}
Beispiel #2
0
      return users.map((user, i) => {
        const data = rankList[i];
        if (data.count !== lastCount) {
          no = i + 1;
          lastCount = data.count;
        }

        const noText = lodash.padEnd(no, 3);
        const name = lodash.padEnd(user.getEscapedName(), 12);
        const count = lodash.padEnd(data.count, 3);
        return `No.${noText}  ${name}  ${count}`;
      });
Beispiel #3
0
  book.chapters.forEach(function(c) {
    cline += _.padEnd(c.number, pln, ' ');
    vline += _.padEnd(c.numVerses(), pln, ' ');

    if (cline.length > lineMaxLen - longestName - 3) {
      tres += cline.trim() + CRLF;
      tres += ppad;

      tres += vline.trim() + CRLF + CRLF;
      tres += ppad;

      cline = '';
      vline = '';
    }
  });
 return (request) => {
   if (!debugThrottle.enabled) return
   let rate
   let check = new Date(Date.now() - request.throttle.ratePer)
   rate = request.throttle._requestTimes.length - 1 - _.findLastIndex(
     request.throttle._requestTimes,
     (date) => (date < check)
   )
   count += 1
   console.log([
     '| ',
     _.padEnd(prefix, 10, ' '),
     '| ',
     _.padStart(count, 3, ' '),
     ' | ',
     _.padStart(Date.now() - start, 6, ' '),
     ' | conc: ',
     _.padStart(request.throttle._current, 3, ' '),
     ' | rate: ',
     _.padStart(rate, 3, ' '),
     ' | queued: ',
     _.padStart(request.throttle._buffer.length, 3, ' '),
     ' | ',
     request.serial
   ].join(''))
 }
Beispiel #5
0
  _.each(lb.BBM.instance().ids(), function(n, id) {
    var b = bible.getBook(id);
    if (b === null) {
      return;
    }

    var nvs = 0;
    b.chapters.forEach(function(c) {
      nvs += c.numVerses();
    });

    res += _.padEnd(selectName(b.te.id), longestName, ' ') +
      _.padEnd(b.numChapters(), 6, ' ') +
      nvs + CRLF;

    tcs += b.numChapters();
    tvs += nvs;
    tbs++;
  });
Beispiel #6
0
            _.forEach(records, function(recordId, idx) {
                var record = userRecords[recordId],
                    date
                    ;
                if (record) {
                    recordsList.push(record);

                    date = util.format("%s/%s/%s", record.date.year, record.date.month, record.date.day);
                    report += util.format("| %s | %s | %s | %s | %s |\n",
                        _.padStart(idx, 3),
                        _.padEnd(record.accountId, 6),
                        _.padEnd(date, 10),
                        _.padEnd(record.step, 2),
                        _.padEnd(record.comment, 30)
                    );
                } else {
                    reportData.wrongRecords += 1;
                }
            });
Beispiel #7
0
function rowTemplate(number, name, viewers, game) {
  const numberColumns = 6;
  const nameColumns = 21;
  const viewersColumns = 13;
  const gameColumns = 40;
  const paddedNumber = _.padEnd(
    _.truncate(number, { length: numberColumns }), numberColumns);
  const paddedName = _.padEnd(
    _.truncate(name, { length: nameColumns }), nameColumns);
  const paddedViewers = _.padEnd(
    typeof(number) === 'number'
      ? _.truncate(
        new Intl.NumberFormat().format(viewers), {
          length: viewersColumns
        })
      : viewers, viewersColumns);
  const truncatedGame = _.truncate(game, { length: gameColumns });
  return ` ${paddedNumber}${paddedName}${paddedViewers}${truncatedGame}`;
}
        let commands = commandList.map((command) => {
                if (command.noHelp) {
                    return null;
                }

                if (command.adminCommand && !(this.isAdmin() || this.isOwner())) {
                    return null;
                }

                return `${_.padEnd(command.name, longestCommand)}${command.adminCommand ? ' - Admin' : ''} - ${command.description}`;
            })
Beispiel #9
0
      scenario.steps.forEach((step) => {
        if (!step.hidden) {
          let stepDesc = colorize(
            indent(2) + _.padEnd(step.keyword + step.name, maxStepLength) + indent(1),
            colorMap[step.result.status]
            );

          let stepSource;
          if (_.isEmpty(step.match)) {
            // undefined and abiguous steps
            stepSource = featureFile + ':' + step.line;
          } else {
            stepSource = path.relative(process.cwd(), step.match.location);
          }

          let lineStr = colorize('# ' + stepSource, colorMap.comment);
          buffer.log(stepDesc + lineStr);

          if (step.result.status === 'failed') {
            buffer.log(colorize(indent(2) + step.result.error_message + '\n', 'red'));
            passed = false;
          }
        }

        if (step.hidden && step.result.status === 'failed') {
          buffer.log(colorize(indent(2) + _.padEnd(step.keyword, maxStepLength) + indent(1), 'red'));
          buffer.log(colorize(indent(2) + step.result.error_message + '\n', 'red'));
        }

        if (step.result.status.toLowerCase() === 'undefined') {
          this.undefinedSteps.push(step.keyword + step.name);
        }

        if (this.stepStatuses[step.result.status]) {
          this.stepStatuses[step.result.status]++;
        } else {
          this.stepStatuses[step.result.status] = 1;
        }

        this.totalSteps++;
      });
Beispiel #10
0
function wordwrap (text, width, separator, keepLF) {
    var wrappedText = '';
    var rows = text.split('\n');
    for (var i = 0; i < rows.length; i++) {
        var row = rows[i];
        if (keepLF === true && i !== 0) {
            wrappedText = wrappedText + '\\n';
        }
        wrappedText = wrappedText + separator + _.padEnd(row,width) + separator;
    }
    return wrappedText;
}