MCPcopy
hub / github.com/markdoc/markdoc / Variable

Class Variable

src/ast/variable.ts:3–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import type { Config, AstType } from '../types';
2
3export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…