summaryrefslogtreecommitdiff
path: root/src/ast.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.ts')
-rw-r--r--src/ast.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ast.ts b/src/ast.ts
index 6c0bd7bd2..88178d399 100644
--- a/src/ast.ts
+++ b/src/ast.ts
@@ -2,11 +2,13 @@ import type { Attribute } from './parser/interfaces';
// AST utility functions
+/** Get TemplateNode attribute from name */
export function getAttr(attributes: Attribute[], name: string): Attribute | undefined {
const attr = attributes.find((a) => a.name === name);
return attr;
}
+/** Get TemplateNode attribute by value */
export function getAttrValue(attributes: Attribute[], name: string): string | undefined {
const attr = getAttr(attributes, name);
if (attr) {
@@ -14,6 +16,7 @@ export function getAttrValue(attributes: Attribute[], name: string): string | un
}
}
+/** Set TemplateNode attribute value */
export function setAttrValue(attributes: Attribute[], name: string, value: string): void {
const attr = attributes.find((a) => a.name === name);
if (attr) {