@desc Updates registrant contact details in state[ {domainName} ].data

@param {Object} [domainState] Current state for {domainName}.
@param {Object} [registrantContactDetails] New registrant contact details
@return {Array} New data state.
function mergeDomainRegistrantContactDetails( domainState, registrantContactDetails ) {
	return isArray( domainState.data )
		? domainState.data.map( item => {
				if ( item.type === whoisType.REGISTRANT ) {
					return {
						...item,
						...registrantContactDetails,
					};
				}
				return item;
		  } )
		: [
				{
					...registrantContactDetails,
					type: whoisType.REGISTRANT,
				},
		  ];
}