9 lines
326 B
TypeScript
Executable File
9 lines
326 B
TypeScript
Executable File
export function interpolate(template: string, data: { [key: string]: string }) {
|
|
return template.replace(/{{(.*?)}}/g, (_, key) => data[key.trim()]);
|
|
}
|
|
|
|
export function getCorrectDOM(componentTag: string): Node {
|
|
const dom = document?.querySelector(componentTag)?.shadowRoot || (document as Node);
|
|
return dom;
|
|
}
|