| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6a6c431 commit 90acb77
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ function Benchmark(fn, configs, options) { | |||
| 38 | 38 | } | |
| 39 | 39 | ||
| 40 | 40 | Benchmark.prototype._parseArgs = function(argv, configs) { | |
| 41 | - const cliOptions = Object.assign({}, configs); | ||
| 41 | + const cliOptions = {}; | ||
| 42 | 42 | const extraOptions = {}; | |
| 43 | 43 | // Parse configuration arguments | |
| 44 | 44 | for (const arg of argv) { | |
@@ -47,17 +47,20 @@ Benchmark.prototype._parseArgs = function(argv, configs) { | |||
| 47 | 47 | console.error('bad argument: ' + arg); | |
| 48 | 48 | process.exit(1); | |
| 49 | 49 | } | |
| 50 | + const config = match[1]; | ||
| 50 | 51 | ||
| 51 | - if (configs[match[1]]) { | ||
| 52 | + if (configs[config]) { | ||
| 52 | 53 | // Infer the type from the config object and parse accordingly | |
| 53 | - const isNumber = typeof configs[match[1]][0] === 'number'; | ||
| 54 | + const isNumber = typeof configs[config][0] === 'number'; | ||
| 54 | 55 | const value = isNumber ? +match[2] : match[2]; | |
| 55 | - cliOptions[match[1]] = [value]; | ||
| 56 | + if (!cliOptions[config]) | ||
| 57 | + cliOptions[config] = []; | ||
| 58 | + cliOptions[config].push(value); | ||
| 56 | 59 | } else { | |
| 57 | - extraOptions[match[1]] = match[2]; | ||
| 60 | + extraOptions[config] = match[2]; | ||
| 58 | 61 | } | |
| 59 | 62 | } | |
| 60 | - return { cli: cliOptions, extra: extraOptions }; | ||
| 63 | + return { cli: Object.assign({}, configs, cliOptions), extra: extraOptions }; | ||
| 61 | 64 | }; | |
| 62 | 65 | ||
| 63 | 66 | Benchmark.prototype._queue = function(options) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments