Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

improve reading of arguments

  • Loading branch information...
commit 17c00297f742668b1a498322e9e0b55e4a0a54e9 1 parent 7259912
@Floby authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/arguments.js
View
6 lib/arguments.js
@@ -40,8 +40,7 @@ exports.parseArgs = function parseArgs() {
function readFiles (arg) {
if(!arg) return;
- var int = parseInt(arg);
- if(isNaN(int)) {
+ if(! /^\d+$/.test(arg)) {
queue.unshift(readFiles);
queue.unshift(readFileName);
}
@@ -84,6 +83,7 @@ exports.parseArgs = function parseArgs() {
}
function readPort(arg) {
+ if(! /^\d+$/.test(arg)) return arg;
var port = parseInt(arg);
if(!isNaN(port)) {
res.port = parseInt(arg);
@@ -113,7 +113,7 @@ exports.parseArgs = function parseArgs() {
while(args.length) {
var f = queue.shift();
var arg = args.shift();
- //console.log('parsing %s using %s', arg, f.name);
+ //console.log('parsing %s using %s', arg, f.name);
var r = f(arg);
if(r) args.unshift(arg);
}
Please sign in to comment.
Something went wrong with that request. Please try again.