示例#1
0
ArangoQueryCursor.prototype.toString = function () {
  var rows = [ ], i = 0;
  while (++i <= 10 && this.hasNext()) {
    rows.push(this.next());
  }

  var result = "[object ArangoQueryCursor";

  if (this.data.id) {
    result += " " + this.data.id;
  }

  if (this._count !== null && this._count !== undefined) {
    result += ", count: " + this._count;
  }

  result += ", hasMore: " + (this.hasNext() ? "true" : "false");

  result += "]";

  if (rows.length > 0) {
    var old = internal.startCaptureMode();
    internal.print(rows);
    result += "\n\n" + internal.stopCaptureMode(old);

    if (this.hasNext()) {
      result += "\ntype 'more' to show more documents\n";
      more = this; // assign cursor to global variable more!
    }
  }

  return result;
};
示例#2
0
    return "at assertion #" + counter + ": " + str.replace(/\?/g, function () { 
      internal.startCaptureMode();
      internal.print(a.shift());

      var outputWithoutNewline = internal.stopCaptureMode();
      return outputWithoutNewline.substr(0, outputWithoutNewline.length - 1);
    });
示例#3
0
var log = function (a) {
  internal.startCaptureMode();
  print(a);
  appender(internal.stopCaptureMode());
};