wiseService/wiseSource.js
/**
   * Convert field ids and string values into the encoded form used in WISE.
   *
   * This method tags a variable number of arguments, each in a pair of field id and string value.
   * @returns {buffer} - the endcoded results
   */
Convert field ids and string values into the encoded form used in WISE.
This method tags a variable number of arguments, each in a pair of field id and string value.
@returns {buffer} - the endcoded results
Convert field ids and string values into the encoded form used in WISE . This method tags a variable number of arguments each in a pair of field id and string value . @returns { buffer } - the endcoded results
static encodeResult () {
    let l;
    let len = 0;
    for (let a = 1; a < arguments.length; a += 2) {
      if (typeof (arguments[a]) === 'number') {
        arguments[a] = arguments[a].toString();
      }
      l = Buffer.byteLength(arguments[a]);
      if (l > 250) {
        arguments[a] = arguments[a].substring(0, 240);
      }
      len += 3 + Buffer.byteLength(arguments[a]);
    }
    const buf = Buffer.allocUnsafe(len + 1);
    let offset = 1;
    for (let a = 1; a < arguments.length; a += 2) {
      buf.writeUInt8(arguments[a - 1], offset);
      len = Buffer.byteLength(arguments[a]);
      buf.writeUInt8(len + 1, offset + 1);
      l = buf.write(arguments[a], offset + 2);
      buf.writeUInt8(0, offset + l + 2);
      offset += 3 + l;
    }
    buf[0] = arguments.length / 2;
    return buf;
  }
static encodeResult ( ) { let l ; let len = 0 ; for ( let a = 1 ; a < arguments . length ; a += 2 ) { if ( typeof ( arguments [ a ] ) === 'number' ) { arguments [ a ] = arguments [ a ] . toString ( ) ; } l = Buffer . byteLength ( arguments [ a ] ) ; if ( l > 250 ) { arguments [ a ] = arguments [ a ] . substring ( 0 , 240 ) ; } len += 3 + Buffer . byteLength ( arguments [ a ] ) ; } const buf = Buffer . allocUnsafe ( len + 1 ) ; let offset = 1 ; for ( let a = 1 ; a < arguments . length ; a += 2 ) { buf . writeUInt8 ( arguments [ a - 1 ] , offset ) ; len = Buffer . byteLength ( arguments [ a ] ) ; buf . writeUInt8 ( len + 1 , offset + 1 ) ; l = buf . write ( arguments [ a ] , offset + 2 ) ; buf . writeUInt8 ( 0 , offset + l + 2 ) ; offset += 3 + l ; } buf [ 0 ] = arguments . length / 2 ; return buf ; }
Convert field ids and string values into the encoded form used in WISE.
Convert field ids and string values into the encoded form used in WISE .