Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

command_result.js 825B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. /**
  3. * Creates a new CommandResult instance
  4. * @class
  5. * @param {object} result CommandResult object
  6. * @param {Connection} connection A connection instance associated with this result
  7. * @return {CommandResult} A cursor instance
  8. */
  9. var CommandResult = function(result, connection, message) {
  10. this.result = result;
  11. this.connection = connection;
  12. this.message = message;
  13. };
  14. /**
  15. * Convert CommandResult to JSON
  16. * @method
  17. * @return {object}
  18. */
  19. CommandResult.prototype.toJSON = function() {
  20. let result = Object.assign({}, this, this.result);
  21. delete result.message;
  22. return result;
  23. };
  24. /**
  25. * Convert CommandResult to String representation
  26. * @method
  27. * @return {string}
  28. */
  29. CommandResult.prototype.toString = function() {
  30. return JSON.stringify(this.toJSON());
  31. };
  32. module.exports = CommandResult;