General cleanup of single-line statements
This commit is contained in:
parent
dd553a55f2
commit
3672a1b712
27
lib/robot.js
27
lib/robot.js
|
@ -147,7 +147,10 @@ Robot.prototype.toJSON = function() {
|
|||
// Returns initialized connections
|
||||
Robot.prototype.initConnections = function(connections) {
|
||||
Logger.info("Initializing connections.");
|
||||
if (connections == null) { return; }
|
||||
|
||||
if (connections == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
connections = [].concat(connections);
|
||||
|
||||
|
@ -168,7 +171,10 @@ Robot.prototype.initConnections = function(connections) {
|
|||
// Returns initialized devices
|
||||
Robot.prototype.initDevices = function(devices) {
|
||||
Logger.info("Initializing devices.");
|
||||
if (devices == null) { return; }
|
||||
|
||||
if (devices == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
devices = [].concat(devices);
|
||||
|
||||
|
@ -260,8 +266,13 @@ Robot.prototype.startDevices = function(callback) {
|
|||
//
|
||||
// Returns nothing
|
||||
Robot.prototype.halt = function() {
|
||||
for (var d in this.devices) { this.devices[d].halt(); }
|
||||
for (var c in this.connections) { this.connections[c].halt(); }
|
||||
for (var d in this.devices) {
|
||||
this.devices[d].halt();
|
||||
}
|
||||
|
||||
for (var c in this.connections) {
|
||||
this.connections[c].halt();
|
||||
}
|
||||
};
|
||||
|
||||
// Public: Initialize an adaptor and adds it to @robot.adaptors
|
||||
|
@ -271,7 +282,9 @@ Robot.prototype.halt = function() {
|
|||
//
|
||||
// Returns the adaptor
|
||||
Robot.prototype.initAdaptor = function(adaptorName, connection, opts) {
|
||||
if (opts == null) { opts = {}; }
|
||||
if (opts == null) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
var adaptor = this.requireAdaptor(adaptorName, opts).adaptor({
|
||||
name: adaptorName,
|
||||
|
@ -333,7 +346,9 @@ Robot.prototype.registerAdaptor = function(moduleName, adaptorName) {
|
|||
//
|
||||
// Returns the new driver
|
||||
Robot.prototype.initDriver = function(driverName, device, opts) {
|
||||
if (opts == null) { opts = {}; }
|
||||
if (opts == null) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
var driver = this.requireDriver(driverName).driver({
|
||||
name: driverName,
|
||||
|
|
Loading…
Reference in New Issue