refactor: add has() and get() to MacrosParser (#4626)

This commit is contained in:
Wolfsblvt
2025-10-07 20:19:24 +02:00
committed by GitHub
parent 806726d737
commit 01e3880587
+18
View File
@@ -56,6 +56,24 @@ export class MacrosParser {
}
};
/**
* Access a macro by its name.
* @param {string} key Macro name (key)
* @returns {string|MacroFunction|undefined} The macro value
*/
static get(key) {
return MacrosParser.#macros.get(key);
}
/**
* Checks if a macro is registered.
* @param {string} key Macro name (key)
* @returns {boolean} True if the macro is registered, false otherwise
*/
static has(key) {
return MacrosParser.#macros.has(key);
}
/**
* Registers a global macro that can be used anywhere where substitution is allowed.
* @param {string} key Macro name (key)