lib/commandCenter/httpBatchHandler.js
function resolveFilesInParams(params, files) {
	var fileIds = Object.keys(files || {});

	var fileCount = fileIds.length;
	if (fileCount === 0) {
		return;
	}

	// scan all members for files, and collect children

	function addMembers(list, obj) {
		var keys = Object.keys(obj || {});

		for (var i = 0; i < keys.length; i++) {
			list.push({
				owner: obj,
				key: keys[i],
				value: obj[keys[i]]
			});
		}
	}

	var list = [];

	addMembers(list, params);

	for (var i = 0; i < list.length && fileCount > 0; i++) {
		var member = list[i];

		if (!member.value) {
			continue;
		}

		var type = typeof member.value;

		if (type === 'object') {
			// append children to the end of the list

			addMembers(list, member.value);
		} else if (type === 'string' && files[member.value]) {
			// file found for this property, so assign it

			var file = files[member.value];

			logger.verbose('Accepted file', '"' + file.partName + '":', file.fileName);

			member.owner[member.key] = file;

			delete files[member.value];
			fileCount -= 1;
		}
	}
}
function resolveFilesInParams(params, files) {
	var fileIds = Object.keys(files || {});

	var fileCount = fileIds.length;
	if (fileCount === 0) {
		return;
	}

	// scan all members for files, and collect children

	function addMembers(list, obj) {
		var keys = Object.keys(obj || {});

		for (var i = 0; i < keys.length; i++) {
			list.push({
				owner: obj,
				key: keys[i],
				value: obj[keys[i]]
			});
		}
	}

	var list = [];

	addMembers(list, params);

	for (var i = 0; i < list.length && fileCount > 0; i++) {
		var member = list[i];

		if (!member.value) {
			continue;
		}

		var type = typeof member.value;

		if (type === 'object') {
			// append children to the end of the list

			addMembers(list, member.value);
		} else if (type === 'string' && files[member.value]) {
			// file found for this property, so assign it

			var file = files[member.value];

			logger.verbose('Accepted file', '"' + file.partName + '":', file.fileName);

			member.owner[member.key] = file;

			delete files[member.value];
			fileCount -= 1;
		}
	}
}
function resolveFilesInParams ( params , files ) { var fileIds = Object . keys ( files || { } ) ; var fileCount = fileIds . length ; if ( fileCount === 0 ) { return ; } // scan all members for files, and collect children function addMembers ( list , obj ) { var keys = Object . keys ( obj || { } ) ; for ( var i = 0 ; i < keys . length ; i ++ ) { list . push ( { owner : obj , key : keys [ i ] , value : obj [ keys [ i ] ] } ) ; } } var list = [ ] ; addMembers ( list , params ) ; for ( var i = 0 ; i < list . length && fileCount > 0 ; i ++ ) { var member = list [ i ] ; if ( ! member . value ) { continue ; } var type = typeof member . value ; if ( type === 'object' ) { // append children to the end of the list addMembers ( list , member . value ) ; } else if ( type === 'string' && files [ member . value ] ) { // file found for this property, so assign it var file = files [ member . value ] ; logger . verbose ( 'Accepted file' , '"' + file . partName + '":' , file . fileName ) ; member . owner [ member . key ] = file ; delete files [ member . value ] ; fileCount -= 1 ; } } }
Replace file placeholders in params with actual file data.

@param {Object} params
@param {Object} files
Replace file placeholders in params with actual file data .