format/html.js
function commentNode(outNode, options) {
	const node = outNode.node;

	if (!options.enabled || !options.trigger || !node.name) {
		return;
	}

	const attrs = outNode.node.attributes.reduce((out, attr) => {
		if (attr.name && attr.value != null) {
			out[attr.name.toUpperCase().replace(/-/g, '_')] = attr.value;
		}

		return out;
	}, {});

	// add comment only if attribute trigger is present
	for (let i = 0, il = options.trigger.length; i < il; i++) {
		if (options.trigger[i].toUpperCase() in attrs) {
			outNode.open = template(options.before, attrs) + outNode.open;
			if (outNode.close) {
				outNode.close += template(options.after, attrs);
			}
			break;
		}
	}
}
function commentNode(outNode, options) {
	const node = outNode.node;

	if (!options.enabled || !options.trigger || !node.name) {
		return;
	}

	const attrs = outNode.node.attributes.reduce((out, attr) => {
		if (attr.name && attr.value != null) {
			out[attr.name.toUpperCase().replace(/-/g, '_')] = attr.value;
		}

		return out;
	}, {});

	// add comment only if attribute trigger is present
	for (let i = 0, il = options.trigger.length; i < il; i++) {
		if (options.trigger[i].toUpperCase() in attrs) {
			outNode.open = template(options.before, attrs) + outNode.open;
			if (outNode.close) {
				outNode.close += template(options.after, attrs);
			}
			break;
		}
	}
}
function commentNode ( outNode , options ) { const node = outNode . node ; if ( ! options . enabled || ! options . trigger || ! node . name ) { return ; } const attrs = outNode . node . attributes . reduce ( ( out , attr ) => { if ( attr . name && attr . value != null ) { out [ attr . name . toUpperCase ( ) . replace ( / - / g , '_' ) ] = attr . value ; } return out ; } , { } ) ; // add comment only if attribute trigger is present for ( let i = 0 , il = options . trigger . length ; i < il ; i ++ ) { if ( options . trigger [ i ] . toUpperCase ( ) in attrs ) { outNode . open = template ( options . before , attrs ) + outNode . open ; if ( outNode . close ) { outNode . close += template ( options . after , attrs ) ; } break ; } } }
Comments given output node, if required
@param  {OutputNode} outNode
@param  {Object} options
Comments given output node if required