tools/ScriptUtils.js
function(parsoidOptions, cliOpts) {
		[
			'fetchConfig',
			'fetchTemplates',
			'fetchImageInfo',
			'expandExtensions',
			'rtTestMode',
			'addHTMLTemplateParameters',
		].forEach(function(c) {
			if (cliOpts[c] !== undefined) {
				parsoidOptions[c] = ScriptUtils.booleanOption(cliOpts[c]);
			}
		});
		if (cliOpts.usePHPPreProcessor !== undefined) {
			parsoidOptions.usePHPPreProcessor = parsoidOptions.fetchTemplates &&
				ScriptUtils.booleanOption(cliOpts.usePHPPreProcessor);
		}
		if (cliOpts.maxDepth !== undefined) {
			parsoidOptions.maxDepth = typeof (cliOpts.maxdepth) === 'number' ?
				cliOpts.maxdepth : parsoidOptions.maxDepth;
		}
		if (cliOpts.apiURL) {
			if (!Array.isArray(parsoidOptions.mwApis)) {
				parsoidOptions.mwApis = [];
			}
			parsoidOptions.mwApis.push({ prefix: 'customwiki', uri: cliOpts.apiURL });
		}
		if (cliOpts.addHTMLTemplateParameters !== undefined) {
			parsoidOptions.addHTMLTemplateParameters =
				ScriptUtils.booleanOption(cliOpts.addHTMLTemplateParameters);
		}
		if (cliOpts.lint) {
			parsoidOptions.linting = true;
			if (!parsoidOptions.linter) {
				parsoidOptions.linter = {};
			}
			parsoidOptions.linter.sendAPI = false;
		}
		if (cliOpts.useBatchAPI !== null) {
			parsoidOptions.useBatchAPI = ScriptUtils.booleanOption(cliOpts.useBatchAPI);
		}
		if (cliOpts.phpConfigFile) {
			parsoidOptions.phpConfigFile = cliOpts.phpConfigFile;
		}

		return parsoidOptions;
	}
function(parsoidOptions, cliOpts) {
		[
			'fetchConfig',
			'fetchTemplates',
			'fetchImageInfo',
			'expandExtensions',
			'rtTestMode',
			'addHTMLTemplateParameters',
		].forEach(function(c) {
			if (cliOpts[c] !== undefined) {
				parsoidOptions[c] = ScriptUtils.booleanOption(cliOpts[c]);
			}
		});
		if (cliOpts.usePHPPreProcessor !== undefined) {
			parsoidOptions.usePHPPreProcessor = parsoidOptions.fetchTemplates &&
				ScriptUtils.booleanOption(cliOpts.usePHPPreProcessor);
		}
		if (cliOpts.maxDepth !== undefined) {
			parsoidOptions.maxDepth = typeof (cliOpts.maxdepth) === 'number' ?
				cliOpts.maxdepth : parsoidOptions.maxDepth;
		}
		if (cliOpts.apiURL) {
			if (!Array.isArray(parsoidOptions.mwApis)) {
				parsoidOptions.mwApis = [];
			}
			parsoidOptions.mwApis.push({ prefix: 'customwiki', uri: cliOpts.apiURL });
		}
		if (cliOpts.addHTMLTemplateParameters !== undefined) {
			parsoidOptions.addHTMLTemplateParameters =
				ScriptUtils.booleanOption(cliOpts.addHTMLTemplateParameters);
		}
		if (cliOpts.lint) {
			parsoidOptions.linting = true;
			if (!parsoidOptions.linter) {
				parsoidOptions.linter = {};
			}
			parsoidOptions.linter.sendAPI = false;
		}
		if (cliOpts.useBatchAPI !== null) {
			parsoidOptions.useBatchAPI = ScriptUtils.booleanOption(cliOpts.useBatchAPI);
		}
		if (cliOpts.phpConfigFile) {
			parsoidOptions.phpConfigFile = cliOpts.phpConfigFile;
		}

		return parsoidOptions;
	}
function ( parsoidOptions , cliOpts ) { [ 'fetchConfig' , 'fetchTemplates' , 'fetchImageInfo' , 'expandExtensions' , 'rtTestMode' , 'addHTMLTemplateParameters' , ] . forEach ( function ( c ) { if ( cliOpts [ c ] !== undefined ) { parsoidOptions [ c ] = ScriptUtils . booleanOption ( cliOpts [ c ] ) ; } } ) ; if ( cliOpts . usePHPPreProcessor !== undefined ) { parsoidOptions . usePHPPreProcessor = parsoidOptions . fetchTemplates && ScriptUtils . booleanOption ( cliOpts . usePHPPreProcessor ) ; } if ( cliOpts . maxDepth !== undefined ) { parsoidOptions . maxDepth = typeof ( cliOpts . maxdepth ) === 'number' ? cliOpts . maxdepth : parsoidOptions . maxDepth ; } if ( cliOpts . apiURL ) { if ( ! Array . isArray ( parsoidOptions . mwApis ) ) { parsoidOptions . mwApis = [ ] ; } parsoidOptions . mwApis . push ( { prefix : 'customwiki' , uri : cliOpts . apiURL } ) ; } if ( cliOpts . addHTMLTemplateParameters !== undefined ) { parsoidOptions . addHTMLTemplateParameters = ScriptUtils . booleanOption ( cliOpts . addHTMLTemplateParameters ) ; } if ( cliOpts . lint ) { parsoidOptions . linting = true ; if ( ! parsoidOptions . linter ) { parsoidOptions . linter = { } ; } parsoidOptions . linter . sendAPI = false ; } if ( cliOpts . useBatchAPI !== null ) { parsoidOptions . useBatchAPI = ScriptUtils . booleanOption ( cliOpts . useBatchAPI ) ; } if ( cliOpts . phpConfigFile ) { parsoidOptions . phpConfigFile = cliOpts . phpConfigFile ; } return parsoidOptions ; }
Sets templating and processing flags on an object,
based on an options object.

@param {Object} parsoidOptions Object to be assigned to the ParsoidConfig.
@param {Object} cliOpts The options object to use for setting the debug flags.
@return {Object} The modified object.
Sets templating and processing flags on an object based on an options object .