diff options
Diffstat (limited to 'src/ast.ts')
-rw-r--r-- | src/ast.ts | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/ast.ts b/src/ast.ts deleted file mode 100644 index faf4b3eb6..000000000 --- a/src/ast.ts +++ /dev/null @@ -1,28 +0,0 @@ -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) { - return attr.value[0]?.data; - } -} - -/** Set TemplateNode attribute value */ -export function setAttrValue(attributes: Attribute[], name: string, value: string): void { - const attr = attributes.find((a) => a.name === name); - if (attr) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - attr.value[0]!.data = value; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - attr.value[0]!.raw = value; - } -} |