From b46c94aaf95b392e6e87cb845762504a23a69577 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. --- packager/parseCommandLine.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packager/parseCommandLine.js b/packager/parseCommandLine.js index 17a2d8af4d..36b8ab119d 100644 --- a/packager/parseCommandLine.js +++ b/packager/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