lib/index.js
function copyAttributes (templateAst, componentNode, preserveType) {
	for (let attributeName in componentNode.attrs) {
		if (!(attributeName in skippedAttributes)) {
			templateAst[0].attrs = templateAst[0].attrs || {};

			if (templateAst[0].attrs[attributeName] && attributeName === 'class') {
				templateAst[0].attrs[attributeName][0].content += ' ' + componentNode.attrs[attributeName][0].content;
			}
			else {
				templateAst[0].attrs[attributeName] = componentNode.attrs[attributeName];
			}
		}

		if (preserveType) {
			const typeAttribute = preserveType === true ? 'type' : preserveType;
			const typeAttributeValue = componentNode.attrs.type;

			if (typeAttributeValue) {
				templateAst[0].attrs = templateAst[0].attrs || {};
				templateAst[0].attrs[typeAttribute] = typeAttributeValue;
			}
		}
	}
}
function copyAttributes (templateAst, componentNode, preserveType) {
	for (let attributeName in componentNode.attrs) {
		if (!(attributeName in skippedAttributes)) {
			templateAst[0].attrs = templateAst[0].attrs || {};

			if (templateAst[0].attrs[attributeName] && attributeName === 'class') {
				templateAst[0].attrs[attributeName][0].content += ' ' + componentNode.attrs[attributeName][0].content;
			}
			else {
				templateAst[0].attrs[attributeName] = componentNode.attrs[attributeName];
			}
		}

		if (preserveType) {
			const typeAttribute = preserveType === true ? 'type' : preserveType;
			const typeAttributeValue = componentNode.attrs.type;

			if (typeAttributeValue) {
				templateAst[0].attrs = templateAst[0].attrs || {};
				templateAst[0].attrs[typeAttribute] = typeAttributeValue;
			}
		}
	}
}
function copyAttributes ( templateAst , componentNode , preserveType ) { for ( let attributeName in componentNode . attrs ) { if ( ! ( attributeName in skippedAttributes ) ) { templateAst [ 0 ] . attrs = templateAst [ 0 ] . attrs || { } ; if ( templateAst [ 0 ] . attrs [ attributeName ] && attributeName === 'class' ) { templateAst [ 0 ] . attrs [ attributeName ] [ 0 ] . content += ' ' + componentNode . attrs [ attributeName ] [ 0 ] . content ; } else { templateAst [ 0 ] . attrs [ attributeName ] = componentNode . attrs [ attributeName ] ; } } if ( preserveType ) { const typeAttribute = preserveType === true ? 'type' : preserveType ; const typeAttributeValue = componentNode . attrs . type ; if ( typeAttributeValue ) { templateAst [ 0 ] . attrs = templateAst [ 0 ] . attrs || { } ; templateAst [ 0 ] . attrs [ typeAttribute ] = typeAttributeValue ; } } } }
Copy attributes from 'node' to the first node in 'componentAst'
@param {ReshapeAst} templateAst - AST from the component source template
@param {ReshapeAstNode} componentNode - '<component>' node
@param {boolean|string} preserveType - If 'true', the 'type' attributed will preserved; if a string value
the 'type' attribute will be copied to an attribute named by the value
Copy attributes from node to the first node in componentAst