(document: Document, id: string)
| 38 | * the attribute is absent, the JSON is invalid, or no entry matches the id. |
| 39 | */ |
| 40 | export function readVariableDefault(document: Document, id: string): unknown { |
| 41 | const decls = readDecls(document); |
| 42 | if (!decls) return undefined; |
| 43 | const idx = indexOfId(decls.arr, id); |
| 44 | return idx < 0 ? undefined : decls.arr[idx]?.default; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Upsert a variable's `default`. No-ops (returns false) when the attribute is |
no test coverage detected