Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

make sure every variable is defined before use it #19

Merged
merged 2 commits into from
Nov 20, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/stomp.js
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ var net = require('net'),

function parse_command(data) {
var command,
this_string = data.toString('utf8', start=0, end=data.length);
this_string = data.toString('utf8', 0, data.length);
command = this_string.split('\n');
return command[0];
};
@@ -70,9 +70,9 @@ function parse_frame(chunk) {

command = parse_command(chunk);
data = chunk.slice(command.length + 1, chunk.length);
data = data.toString('utf8', start=0, end=data.length);
data = data.toString('utf8', 0, data.length);

the_rest = data.split('\n\n');
var the_rest = data.split('\n\n');
headers = parse_headers(the_rest[0]);
body = the_rest.slice(1, the_rest.length);

@@ -300,7 +300,7 @@ Stomp.prototype.disconnect = function() {
* @param {Object} headers
*/
Stomp.prototype.subscribe = function(headers) {
var self = this;
var self = this,
destination = headers['destination'];
headers['session'] = self.session;
send_command(this, 'SUBSCRIBE', headers);
@@ -313,7 +313,7 @@ Stomp.prototype.subscribe = function(headers) {
* @param {Object} headers
*/
Stomp.prototype.unsubscribe = function(headers) {
var self = this;
var self = this,
destination = headers['destination'];
headers['session'] = self.session;
send_command(this, 'UNSUBSCRIBE', headers);
@@ -370,8 +370,8 @@ Stomp.prototype.abort = function(transaction_id) {
* @return {Object} Frame object of message sent
*/
Stomp.prototype.send = function(headers, want_receipt) {
var self = this;
destination = headers['destination'];
var self = this,
destination = headers['destination'],
body = headers['body'] || null;
delete headers['body'];
headers['session'] = self.session;