From f9a6732f5fc8f7c56d2e871cdffefc3ce03eff7b Mon Sep 17 00:00:00 2001 From: Esa-Matti Suuronen Date: Wed, 16 Mar 2011 20:53:40 +0200 Subject: [PATCH] Add missing semicolons and brackets. --- serialport.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/serialport.js b/serialport.js index f217091..a4ed1a7 100644 --- a/serialport.js +++ b/serialport.js @@ -22,15 +22,15 @@ var parsers = { emitter.emit("data", buffer); }, readline: function (delimiter) { - if (!delimiter) { delimiter == "\r" } + if (!delimiter) { delimiter == "\r"; } return function (emitter, buffer) { var lines = buffer.toString().split(delimiter); lines.forEach(function (i) { emitter.emit('data', i); - }) - } + }); + }; } -} +}; // can accept path, baudrate, databits, stopbits, parity @@ -75,8 +75,9 @@ function SerialPort(path, options) { return function () { var buffer = new Buffer(_options.buffersize); var bytes_read = 0, err = null; - try + try { bytes_read = serialport_native.read(file_id, buffer); + } catch (e) { err = e; } @@ -86,7 +87,7 @@ function SerialPort(path, options) { me.close(); } _options.parser(me, buffer.slice(0, bytes_read)); - } + }; })(this.fd, this); this.readWatcher.set(this.fd, true, false); this.readWatcher.start(); @@ -111,8 +112,8 @@ SerialPort.prototype.write = function (b) { serialport_native.write(this.fd, b); else serialport_native.write(this.fd, new Buffer(b)); -} +}; module.exports.SerialPort = SerialPort; -module.exports.parsers = parsers; \ No newline at end of file +module.exports.parsers = parsers;