Files
tom goriunovandGitHub 460e5dc3df update page titles (#1065)
* metadata helpers and values for txs pages

* update titles to the rest of the pages

* refactor getServerSideProps

* dynamically update metadata for token and dapp page

* test

* 404 error page
2023-08-07 08:32:13 -04:00

17 lines
404 B
TypeScript

export default function compileValue(template: string, params: Record<string, string | Array<string> | undefined>) {
const PLACEHOLDER_REGEX = /%(\w+)%/g;
return template.replaceAll(PLACEHOLDER_REGEX, (match, p1) => {
const value = params[p1];
if (Array.isArray(value)) {
return value.join(', ');
}
if (value === undefined) {
return '';
}
return value;
});
}