Small changes to appease JSHint

This commit is contained in:
Andrew Stewart 2014-03-07 23:33:59 -08:00
parent 26008f3ee1
commit c0c4ce6958
10 changed files with 21 additions and 20 deletions

View File

@ -28,6 +28,9 @@
"sinon", "sinon",
"subclass", "subclass",
"proxyTestStubs", "proxyTestStubs",
"proxyFunctionsToObject" "proxyFunctionsToObject",
"every",
"hasProp",
"bind"
] ]
} }

View File

@ -77,7 +77,7 @@ namespace("Cylon", function() {
// //
// Returns this.connector // Returns this.connector
Basestar.prototype.defineAdaptorEvent = function(opts) { Basestar.prototype.defineAdaptorEvent = function(opts) {
if (typeof opts === 'string') { opts = { eventName: opts } } if (typeof opts === 'string') { opts = { eventName: opts }; }
opts['source'] = this.connector; opts['source'] = this.connector;
opts['target'] = this.connection; opts['target'] = this.connection;
@ -93,7 +93,7 @@ namespace("Cylon", function() {
// //
// Returns this.connection // Returns this.connection
Basestar.prototype.defineDriverEvent = function(opts) { Basestar.prototype.defineDriverEvent = function(opts) {
if (typeof opts === 'string') { opts = { eventName: opts } } if (typeof opts === 'string') { opts = { eventName: opts }; }
opts['source'] = this.connection; opts['source'] = this.connection;
opts['target'] = this.device; opts['target'] = this.device;

View File

@ -4,7 +4,7 @@ var os = require('os'),
namespace("Cylon.CLI", function() { namespace("Cylon.CLI", function() {
this.Bluetooth = (function() { this.Bluetooth = (function() {
function Bluetooth() { function Bluetooth() {
this.process = new Cylon.Process; this.process = new Cylon.Process();
this.platform = os.platform(); this.platform = os.platform();
} }

View File

@ -4,7 +4,7 @@ var os = require('os'),
namespace('Cylon.CLI', function() { namespace('Cylon.CLI', function() {
this.Scan = (function() { this.Scan = (function() {
function Scan() { function Scan() {
this.process = new Cylon.Process; this.process = new Cylon.Process();
this.platform = os.platform(); this.platform = os.platform();
} }

View File

@ -48,7 +48,7 @@ var Cylon = (function() {
if (process.platform === "win32") { if (process.platform === "win32") {
var readline = require("readline"), var readline = require("readline"),
io = { input: process.stdin, output: process.stdout } io = { input: process.stdin, output: process.stdout };
readline.createInterface(io).on("SIGINT", function() { readline.createInterface(io).on("SIGINT", function() {
process.emit("SIGINT"); process.emit("SIGINT");
@ -91,7 +91,7 @@ var Cylon = (function() {
// //
// Returns the API configuration // Returns the API configuration
Master.prototype.api = function(opts) { Master.prototype.api = function(opts) {
if (opts == null) { opts = {} }; if (opts == null) { opts = {}; }
var host = opts.host || this.api_config.host, var host = opts.host || this.api_config.host,
port = opts.port || this.api_config.port; port = opts.port || this.api_config.port;

View File

@ -53,7 +53,7 @@ var generateTemplateData = function() {
basename: String(adaptorName).toLowerCase(), basename: String(adaptorName).toLowerCase(),
cylonVersion: pkg.version cylonVersion: pkg.version
}; };
} };
var generator = function(name) { var generator = function(name) {
adaptorName = name; adaptorName = name;

View File

@ -9,7 +9,7 @@ var mocha = new Mocha({ reporter: 'spec', ui: 'bdd'});
function run(cb) { function run(cb) {
var files = grunt.file.expand(__dirname + '/../specs/**/*.spec.js'); var files = grunt.file.expand(__dirname + '/../specs/**/*.spec.js');
console.log(files) console.log(files);
files.forEach(function (file) { files.forEach(function (file) {
mocha.addFile(file); mocha.addFile(file);
}); });

View File

@ -10,7 +10,7 @@
var getArgs = function(args) { var getArgs = function(args) {
return args.length >= 1 ? [].slice.call(args, 0) : []; return args.length >= 1 ? [].slice.call(args, 0) : [];
} };
// The Logger is a global object to facilitate logging stuff to the console (or // The Logger is a global object to facilitate logging stuff to the console (or
// other output) easily and consistently. It's available anywhere in Cylon, as // other output) easily and consistently. It's available anywhere in Cylon, as
@ -24,7 +24,7 @@ global.Logger = {
// //
// Returns the new logger instance // Returns the new logger instance
setup: function(logger) { setup: function(logger) {
if (logger == null) { logger = new BasicLogger; } if (logger == null) { logger = new BasicLogger(); }
if (logger === false) { if (logger === false) {
this.logger = new NullLogger(); this.logger = new NullLogger();
@ -32,7 +32,7 @@ global.Logger = {
this.logger = logger; this.logger = logger;
} }
return this.logger return this.logger;
}, },
toString: function() { return this.logger.toString(); }, toString: function() { return this.logger.toString(); },

View File

@ -203,7 +203,7 @@ namespace("Cylon", function() {
// //
// Returns nothing // Returns nothing
Robot.prototype.startConnections = function(callback) { Robot.prototype.startConnections = function(callback) {
var starters = {} var starters = {};
Logger.info("Starting connections..."); Logger.info("Starting connections...");
@ -222,7 +222,7 @@ namespace("Cylon", function() {
// //
// Returns nothing // Returns nothing
Robot.prototype.startDevices = function(callback) { Robot.prototype.startDevices = function(callback) {
var starters = {} var starters = {};
Logger.info("Starting devices..."); Logger.info("Starting devices...");

View File

@ -132,12 +132,10 @@ global.proxyFunctionsToObject = function(methods, target, base, force) {
global.proxyTestStubs = function(methods, base) { global.proxyTestStubs = function(methods, base) {
if (base == null) { base = this; } if (base == null) { base = this; }
for (var i = 0; i < methods.length; i++) { methods.forEach(function(method) {
var method = methods[i];
base[method] = function() { return true; }; base[method] = function() { return true; };
base.commandList.push(method); base.commandList.push(method);
} });
return base; return base;
}; };
@ -157,8 +155,8 @@ global.proxyTestStubs = function(methods, base) {
// //
// Returns a function wrapper // Returns a function wrapper
global.bind = function(fn, me) { global.bind = function(fn, me) {
return function() { return fn.apply(me, arguments); } return function() { return fn.apply(me, arguments); };
} };
// Public: Monkey-patches Number to have Rails-like //seconds() function. Warning, // Public: Monkey-patches Number to have Rails-like //seconds() function. Warning,
// due to the way the Javascript parser works, applying functions on numbers is // due to the way the Javascript parser works, applying functions on numbers is