| 57 | }; | 57 | }; |
| 58 | | 58 | |
| 59 | /** | 59 | /** |
| | 60 | * Access a macro by its name. |
| | 61 | * @param {string} key Macro name (key) |
| | 62 | * @returns {string|MacroFunction|undefined} The macro value |
| | 63 | */ |
| | 64 | static get(key) { |
| | 65 | return MacrosParser.#macros.get(key); |
| | 66 | } |
| | 67 | |
| | 68 | /** |
| | 69 | * Checks if a macro is registered. |
| | 70 | * @param {string} key Macro name (key) |
| | 71 | * @returns {boolean} True if the macro is registered, false otherwise |
| | 72 | */ |
| | 73 | static has(key) { |
| | 74 | return MacrosParser.#macros.has(key); |
| | 75 | } |
| | 76 | |
| | 77 | /** |
| 60 | * Registers a global macro that can be used anywhere where substitution is allowed. | 78 | * Registers a global macro that can be used anywhere where substitution is allowed. |
| 61 | * @param {string} key Macro name (key) | 79 | * @param {string} key Macro name (key) |
| 62 | * @param {string|MacroFunction} value A string or a function that returns a string | 80 | * @param {string|MacroFunction} value A string or a function that returns a string |