format (result) {
    if (Array.isArray(result)) return this.format(result[0]);
    if (typeof result === 'object') {
      const obj = Object.getOwnPropertyNames(result).reduce((a, b) => {
        if (Array.isArray(result[b])) a[b] = result[b].join(', ') || '[ ]';
        else a[b] = typeof result[b] === 'object' ? JSON.stringify(result[b]) : result[b];
        return a;
      }, {});
      return Object.keys(obj).map((x) => ({ name: x, value: obj[x].toString().length > 1024 ? obj[x].toString().slice(0, 1024) : obj[x].toString() })).slice(0, 24);
    }
    return [{ name: 'Response', value: String(result) }];
  }
/**
     * Parses response from wrapper to an array of fields.
     * @param {any} result Response from wrapper
     */
Parses response from wrapper to an array of fields.
@param {any} result Response from wrapper
Parses response from wrapper to an array of fields . @param { any } result Response from wrapper
format (result) {
    if (Array.isArray(result)) return this.format(result[0]);
    if (typeof result === 'object') {
      const obj = Object.getOwnPropertyNames(result).reduce((a, b) => {
        if (Array.isArray(result[b])) a[b] = result[b].join(', ') || '[ ]';
        else a[b] = typeof result[b] === 'object' ? JSON.stringify(result[b]) : result[b];
        return a;
      }, {});
      return Object.keys(obj).map((x) => ({ name: x, value: obj[x].toString().length > 1024 ? obj[x].toString().slice(0, 1024) : obj[x].toString() })).slice(0, 24);
    }
    return [{ name: 'Response', value: String(result) }];
  }
format ( result ) { if ( Array . isArray ( result ) ) return this . format ( result [ 0 ] ) ; if ( typeof result === 'object' ) { const obj = Object . getOwnPropertyNames ( result ) . reduce ( ( a , b ) => { if ( Array . isArray ( result [ b ] ) ) a [ b ] = result [ b ] . join ( ', ' ) || '[ ]' ; else a [ b ] = typeof result [ b ] === 'object' ? JSON . stringify ( result [ b ] ) : result [ b ] ; return a ; } , { } ) ; return Object . keys ( obj ) . map ( ( x ) => ( { name : x , value : obj [ x ] . toString ( ) . length > 1024 ? obj [ x ] . toString ( ) . slice ( 0 , 1024 ) : obj [ x ] . toString ( ) } ) ) . slice ( 0 , 24 ) ; } return [ { name : 'Response' , value : String ( result ) } ] ; }
Parses response from wrapper to an array of fields.
Parses response from wrapper to an array of fields .