index.js
function convertResponse(response) {
      var results = {tables: [], indexes: []};
      var i=0;
      var start=0;
      if (dbName) {
        results.db = response[0];
        start++;
        i++;
      }
      while (i < start + tableNames.length) {
        tableName = tableNames[i-start];
        results.tables[i-start]=response[i];
        i++;
      }
      start = start + tableNames.length;
      if (tableNames.length > 0) {
        var j = 0;
        var indexNames = Object.keys(tables[tableNames[j]].indexOpts);
        var indexResults;
        indexResults = [];
        results.indexes[j] = indexResults;
        while (i < response.length) {
          indexResults[i-start] = response[i];
          i++;
          while (i-start >= indexNames.length && i < response.length){
            j++;
            indexNames = Object.keys(tables[tableNames[j]].indexOpts);
            indexResults = [];
            results.indexes[j] = indexResults;
            start = i;
          }
        }
      }
      return results;
    }
function convertResponse(response) {
      var results = {tables: [], indexes: []};
      var i=0;
      var start=0;
      if (dbName) {
        results.db = response[0];
        start++;
        i++;
      }
      while (i < start + tableNames.length) {
        tableName = tableNames[i-start];
        results.tables[i-start]=response[i];
        i++;
      }
      start = start + tableNames.length;
      if (tableNames.length > 0) {
        var j = 0;
        var indexNames = Object.keys(tables[tableNames[j]].indexOpts);
        var indexResults;
        indexResults = [];
        results.indexes[j] = indexResults;
        while (i < response.length) {
          indexResults[i-start] = response[i];
          i++;
          while (i-start >= indexNames.length && i < response.length){
            j++;
            indexNames = Object.keys(tables[tableNames[j]].indexOpts);
            indexResults = [];
            results.indexes[j] = indexResults;
            start = i;
          }
        }
      }
      return results;
    }
function convertResponse ( response ) { var results = { tables : [ ] , indexes : [ ] } ; var i = 0 ; var start = 0 ; if ( dbName ) { results . db = response [ 0 ] ; start ++ ; i ++ ; } while ( i < start + tableNames . length ) { tableName = tableNames [ i - start ] ; results . tables [ i - start ] = response [ i ] ; i ++ ; } start = start + tableNames . length ; if ( tableNames . length > 0 ) { var j = 0 ; var indexNames = Object . keys ( tables [ tableNames [ j ] ] . indexOpts ) ; var indexResults ; indexResults = [ ] ; results . indexes [ j ] = indexResults ; while ( i < response . length ) { indexResults [ i - start ] = response [ i ] ; i ++ ; while ( i - start >= indexNames . length && i < response . length ) { j ++ ; indexNames = Object . keys ( tables [ tableNames [ j ] ] . indexOpts ) ; indexResults = [ ] ; results . indexes [ j ] = indexResults ; start = i ; } } } return results ; }
Convert the expr response to something simpler
Convert the expr response to something simpler