Remove lint warnings
This commit is contained in:
parent
e9416129ee
commit
a66b66bd52
26
lib/cylon.js
26
lib/cylon.js
|
@ -88,26 +88,16 @@ Cylon.api = function api(Server, opts) {
|
||||||
try {
|
try {
|
||||||
Server = require(req);
|
Server = require(req);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code === "MODULE_NOT_FOUND") {
|
if (e.code !== "MODULE_NOT_FOUND") {
|
||||||
var messages;
|
|
||||||
|
|
||||||
if (req === "cylon-api-http") {
|
|
||||||
messages = [
|
|
||||||
"The HTTP API is no longer included in Cylon by default.",
|
|
||||||
"To use it, install the plugin module: `npm install cylon-api-http`"
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
messages = [
|
|
||||||
"Cannot find the " + req + " API module.",
|
|
||||||
"You may be able to install it: `npm install " + req + "`"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
_.each(messages, _.arity(Logger.fatal, 1));
|
|
||||||
throw new Error("Missing API plugin - cannot proceed");
|
|
||||||
} else {
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
"Cannot find the " + req + " API module.",
|
||||||
|
"You may be able to install it: `npm install " + req + "`"
|
||||||
|
].forEach(_.arity(Logger.fatal, 1));
|
||||||
|
|
||||||
|
throw new Error("Missing API plugin - cannot proceed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
* Licensed under the Apache 2.0 license.
|
* Licensed under the Apache 2.0 license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint camelcase: 0 */
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var Basestar = require("./basestar"),
|
var Basestar = require("./basestar"),
|
||||||
|
@ -85,7 +83,7 @@ Driver.prototype.setupCommands = function(commands, proxy) {
|
||||||
Utils.proxyFunctionsToObject(commands, proxy, this);
|
Utils.proxyFunctionsToObject(commands, proxy, this);
|
||||||
|
|
||||||
commands.forEach(function(command) {
|
commands.forEach(function(command) {
|
||||||
var snake_case = command.replace(/[A-Z]+/g, function(match) {
|
var snakeCase = command.replace(/[A-Z]+/g, function(match) {
|
||||||
if (match.length > 1) {
|
if (match.length > 1) {
|
||||||
match = match.replace(/[A-Z]$/, function(m) {
|
match = match.replace(/[A-Z]$/, function(m) {
|
||||||
return "_" + m.toLowerCase();
|
return "_" + m.toLowerCase();
|
||||||
|
@ -95,7 +93,7 @@ Driver.prototype.setupCommands = function(commands, proxy) {
|
||||||
return "_" + match.toLowerCase();
|
return "_" + match.toLowerCase();
|
||||||
}).replace(/^_/, "");
|
}).replace(/^_/, "");
|
||||||
|
|
||||||
this.commands[snake_case] = this[command];
|
this.commands[snakeCase] = this[command];
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue