Skip to content

Commit

Permalink
Removed unnecessary if options exist statement
Browse files Browse the repository at this point in the history
  • Loading branch information
m4r1vs authored Jan 14, 2018
1 parent f113d22 commit 5ea1320
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ const importCwd = require("import-cwd"); // used to get the users project detail

const pkg = importCwd("./package.json");

function Jarvis(options) {

function Jarvis(opts) {

const options = opts || {};

// check if port is valid
let portIsValid = true;
if (options && options.port && isNaN(parseInt(options.port))) {
if (options.port && isNaN(parseInt(options.port))) {
portIsValid = false;
console.error(`[JARVIS] your specified port ("${options.port}") is invalid, falling back to 1337, please check it again :)`);
};

this.options = {
port: (options && portIsValid)
port: (portIsValid)
? parseInt(options.port)
: 1337 // fall back to 1337 if port is not a number
};
Expand Down

0 comments on commit 5ea1320

Please sign in to comment.