From 39af67ece3d4ce72d8fbe3ec352db8b9f7290b23 Mon Sep 17 00:00:00 2001 From: Hedger Wang Date: Wed, 20 May 2015 18:38:55 -0700 Subject: [PATCH] Unbreak RN JS server for Android. --- parseCommandLine.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/parseCommandLine.js b/parseCommandLine.js index 17a2d8af..36b8ab11 100644 --- a/parseCommandLine.js +++ b/parseCommandLine.js @@ -52,6 +52,15 @@ function parseCommandLine(config) { if (argv[command] === 'false') { argv[command] = false; } + if (config[i].type === 'string') { + // According to https://github.com/substack/node-optimist#numbers, + // every argument that looks like a number should be converted to one. + var strValue = argv[command]; + var numValue = strValue ? Number(strValue) : undefined; + if (typeof numValue === 'number' && !isNaN(numValue)) { + argv[command] = numValue; + } + } } // Show --help