'use strict';

var defaults = require('./defaults.js');
var transformations = require('./transformations.js');

/**
* Merge icon and alias
*
* Can also be used to merge default values and icon
*/
function mergeIconData(parent, child) {
	const result = transformations.mergeIconTransformations(parent, child);
	for (const key in defaults.defaultExtendedIconProps) if (key in defaults.defaultIconTransformations) {
		if (key in parent && !(key in result)) result[key] = defaults.defaultIconTransformations[key];
	} else if (key in child) result[key] = child[key];
	else if (key in parent) result[key] = parent[key];
	return result;
}

exports.mergeIconData = mergeIconData;
