* Get experiment constant to define from command line arguments, if any * * @return {string|undefined}
()
| 11 | * @return {string|undefined} |
| 12 | */ |
| 13 | function getExperimentConstant() { |
| 14 | const flag = argv['define_experiment_constant']; |
| 15 | // add define flags from arguments |
| 16 | if (Array.isArray(flag)) { |
| 17 | if (flag.length > 1) { |
| 18 | throw new Error('Only one define_experiment_constant flag is allowed'); |
| 19 | } |
| 20 | return flag[0]; |
| 21 | } |
| 22 | if (flag) { |
| 23 | return flag; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Computes options for minify-replace and returns the plugin object. |