diff options
author | 2021-04-01 10:25:28 -0600 | |
---|---|---|
committer | 2021-04-01 10:25:28 -0600 | |
commit | c26c244ca2634d462616d6cf71072fbe26becba2 (patch) | |
tree | 1bd5e83eff9ca88200aacb272c84439f192015ec /src/ast.ts | |
parent | f6a7ac67befff863e34133673efb78ea7ac0fe48 (diff) | |
download | astro-c26c244ca2634d462616d6cf71072fbe26becba2.tar.gz astro-c26c244ca2634d462616d6cf71072fbe26becba2.tar.zst astro-c26c244ca2634d462616d6cf71072fbe26becba2.zip |
Annoying Lint PR #2 (#47)
Diffstat (limited to 'src/ast.ts')
-rw-r--r-- | src/ast.ts | 3 |
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) { |