wiseService/wiseSource.js
/**
   * Combine a array of encoded results into one encoded result
   *
   * @param {object|array} results - Array of results
   * @returns {Buffer} - A single combined result
   */
Combine a array of encoded results into one encoded result
@param {object|array} results - Array of results
@returns {Buffer} - A single combined result
Combine a array of encoded results into one encoded result @param { object|array } results - Array of results @returns { Buffer } - A single combined result
static combineResults (results) {
    if (results.length === 1) {
      return results[0] ? results[0] : WISESource.emptyResult;
    }
    let num = 0;
    let len = 0;
    for (let a = 0; a < results.length; a++) {
      if (!results[a]) {
        continue;
      }
      num += results[a][0];
      len += results[a].length - 1;
    }
    if (len === 0) { return WISESource.emptyResult; }
    const buf = Buffer.allocUnsafe(len + 1);
    let offset = 1;
    for (let a = 0; a < results.length; a++) {
      if (!results[a]) {
        continue;
      }
      results[a].copy(buf, offset, 1);
      offset += results[a].length - 1;
    }
    buf[0] = num;
    return buf;
  }
static combineResults ( results ) { if ( results . length === 1 ) { return results [ 0 ] ? results [ 0 ] : WISESource . emptyResult ; } let num = 0 ; let len = 0 ; for ( let a = 0 ; a < results . length ; a ++ ) { if ( ! results [ a ] ) { continue ; } num += results [ a ] [ 0 ] ; len += results [ a ] . length - 1 ; } if ( len === 0 ) { return WISESource . emptyResult ; } const buf = Buffer . allocUnsafe ( len + 1 ) ; let offset = 1 ; for ( let a = 0 ; a < results . length ; a ++ ) { if ( ! results [ a ] ) { continue ; } results [ a ] . copy ( buf , offset , 1 ) ; offset += results [ a ] . length - 1 ; } buf [ 0 ] = num ; return buf ; }
Combine a array of encoded results into one encoded result
 @param {object|array} results - Array of results
 @returns {Buffer} - A single combined result
Combine a array of encoded results into one encoded result @param { object|array } results - Array of results @returns { Buffer } - A single combined result
// Don't really need to combine 1 result