(a: AttributeValue)
| 69 | } |
| 70 | |
| 71 | function formatAnnotationValue(a: AttributeValue): string | undefined { |
| 72 | const formattedValue = formatScalar(a.value); |
| 73 | |
| 74 | if (formattedValue === undefined) return undefined; |
| 75 | if (a.name === 'primary') return formattedValue; |
| 76 | if (a.name === 'id' && typeof a.value === 'string' && isIdentifier(a.value)) |
| 77 | return '#' + a.value; |
| 78 | if (a.type === 'class' && isIdentifier(a.name)) return '.' + a.name; |
| 79 | |
| 80 | return `${a.name}=${formattedValue}`; |
| 81 | } |
| 82 | |
| 83 | function* formatAttributes(n: Node) { |
| 84 | for (const [key, value] of Object.entries(n.attributes)) { |
no test coverage detected
searching dependent graphs…