spreadAttributes() — astro Function Reference
Architecture documentation for the spreadAttributes() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 527e011a_8bf1_545b_e871_6e06c8b31266["spreadAttributes()"] c35665ab_15da_1077_3e74_d5bc594df46d["index.ts"] 527e011a_8bf1_545b_e871_6e06c8b31266 -->|defined in| c35665ab_15da_1077_3e74_d5bc594df46d style 527e011a_8bf1_545b_e871_6e06c8b31266 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/runtime/server/index.ts lines 73–93
export function spreadAttributes(
values: Record<any, any> = {},
_name?: string,
{ class: scopedClassName }: { class?: string } = {},
) {
let output = '';
// If the compiler passes along a scoped class, merge with existing props or inject it
if (scopedClassName) {
if (typeof values.class !== 'undefined') {
values.class += ` ${scopedClassName}`;
} else if (typeof values['class:list'] !== 'undefined') {
values['class:list'] = [values['class:list'], scopedClassName];
} else {
values.class = scopedClassName;
}
}
for (const [key, value] of Object.entries(values)) {
output += addAttribute(value, key, true, _name);
}
return markHTMLString(output);
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does spreadAttributes() do?
spreadAttributes() is a function in the astro codebase, defined in packages/astro/src/runtime/server/index.ts.
Where is spreadAttributes() defined?
spreadAttributes() is defined in packages/astro/src/runtime/server/index.ts at line 73.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free