eb7b27a4fbb28f6970d97cbc6122684aa20a84f0
[aai/esr-gui.git] /
1 "use strict";
2
3 var setProperty = require('../connection/utils').setProperty
4   , getProperty = require('../connection/utils').getProperty
5   , getSingleProperty = require('../connection/utils').getSingleProperty;
6
7 /**
8  * Creates a new CommandResult instance
9  * @class
10  * @param {object} result CommandResult object
11  * @param {Connection} connection A connection instance associated with this result
12  * @return {CommandResult} A cursor instance
13  */
14 var CommandResult = function(result, connection, message) {
15   this.result = result;
16   this.connection = connection;
17   this.message = message;
18 }
19
20 /**
21  * Convert CommandResult to JSON
22  * @method
23  * @return {object}
24  */
25 CommandResult.prototype.toJSON = function() {
26   return this.result;
27 }
28
29 /**
30  * Convert CommandResult to String representation
31  * @method
32  * @return {string}
33  */
34 CommandResult.prototype.toString = function() {
35   return JSON.stringify(this.toJSON());
36 }
37
38 module.exports = CommandResult;