<commit_before>import createBinding from './binding/index.js';
import deindent from '../../../../utils/deindent.js';

export default function addComponentAttributes ( generator, node, local ) {
	local.staticAttributes = [];
	local.dynamicAttributes = [];
	local.bindings = [];

	node.attributes.forEach( attribute => {
		if ( attribute.type === 'Attribute' ) {
			if ( attribute.value === true ) {
				// attributes without values, e.g. <textarea readonly>
				local.staticAttributes.push({
					name: attribute.name,
					value: true
				});
			}

			else if ( attribute.value.length === 0 ) {
				local.staticAttributes.push({
					name: attribute.name,
					value: `''`
				});
			}

			else if ( attribute.value.length === 1 ) {
				const value = attribute.value[0];

				if ( value.type === 'Text' ) {
					// static attributes
					const result = String( parseFloat( value.data ) ) !== value.data ? JSON.stringify( value.data ) : value.data;
					local.staticAttributes.push({
						name: attribute.name,
						value: result
					});
				}

				else {
					// simple dynamic attributes<commit_msg>just use isNaN<commit_after>import createBinding from './binding/index.js';
import deindent from '../../../../utils/deindent.js';

export default function addComponentAttributes ( generator, node, local ) {
	local.staticAttributes = [];
	local.dynamicAttributes = [];
	local.bindings = [];

	node.attributes.forEach( attribute => {
		if ( attribute.type === 'Attribute' ) {
			if ( attribute.value === true ) {
				// attributes without values, e.g. <textarea readonly>
				local.staticAttributes.push({
					name: attribute.name,
					value: true
				});
			}

			else if ( attribute.value.length === 0 ) {
				local.staticAttributes.push({
					name: attribute.name,
					value: `''`
				});
			}

			else if ( attribute.value.length === 1 ) {
				const value = attribute.value[0];

				if ( value.type === 'Text' ) {
					// static attributes
					const result = isNaN( value.data ) ? JSON.stringify( value.data ) : value.data;
					local.staticAttributes.push({
						name: attribute.name,
						value: result
					});
				}

				else {
					// simple dynamic attributes
{'fraction_non_alphanumeric': 0.15250344510794672, 'fraction_numerical': 0.002756086357372531, 'mean_word_length': 2.679054054054054, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2142665', 'n_tokens_mistral': 799, 'n_tokens_neox': 616, 'n_words': 149}