Home / Function/ styleToObject() — astro Function Reference

styleToObject() — astro Function Reference

Architecture documentation for the styleToObject() function in style-to-object.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  f67d4c0c_61d6_4d27_aae2_ed3cb902435e["styleToObject()"]
  58afbcc5_d627_3dca_f7eb_60147679f7ca["style-to-object.ts"]
  f67d4c0c_61d6_4d27_aae2_ed3cb902435e -->|defined in| 58afbcc5_d627_3dca_f7eb_60147679f7ca
  style f67d4c0c_61d6_4d27_aae2_ed3cb902435e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/markdoc/src/html/css/style-to-object.ts lines 44–70

export function styleToObject(style, iterator) {
	let output = null;
	if (!style || typeof style !== 'string') {
		return output;
	}

	let declaration;
	let declarations = parseInlineStyles(style);
	let hasIterator = typeof iterator === 'function';
	let property;
	let value;

	for (let i = 0, len = declarations.length; i < len; i++) {
		declaration = declarations[i];
		property = declaration.property;
		value = declaration.value;

		if (hasIterator) {
			iterator(property, value, declaration);
		} else if (value) {
			output || (output = {});
			output[property] = value;
		}
	}

	return output;
}

Domain

Subdomains

Frequently Asked Questions

What does styleToObject() do?
styleToObject() is a function in the astro codebase, defined in packages/integrations/markdoc/src/html/css/style-to-object.ts.
Where is styleToObject() defined?
styleToObject() is defined in packages/integrations/markdoc/src/html/css/style-to-object.ts at line 44.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free