| 1 | import type { Config, AstType } from '../types'; |
| 2 | |
| 3 | export default class Variable implements AstType { |
| 4 | readonly $$mdtype = 'Variable'; |
| 5 | |
| 6 | path; |
| 7 | |
| 8 | constructor(path: (string | number)[] = []) { |
| 9 | this.path = path; |
| 10 | } |
| 11 | |
| 12 | resolve({ variables }: Config = {}) { |
| 13 | return variables instanceof Function |
| 14 | ? variables(this.path) |
| 15 | : this.path.reduce((obj = {}, key) => obj[key], variables); |
| 16 | } |
| 17 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…