mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: migrate all
This commit is contained in:
1 parent
5594c0ec3b
commit
320a764d45
38 files changed
+632
-600
No files matched your search
@@ -1,9 +1,19 @@
|
||||
import { assertSecret } from "@blitzkit/core";
|
||||
|
||||
const dev = assertSecret(import.meta.env.DEV);
|
||||
|
||||
export function literals(
|
||||
string: string,
|
||||
literals?: Record<string, string | number>
|
||||
literals?: Record<string, string | number | undefined>
|
||||
) {
|
||||
for (const key in literals) {
|
||||
string = string.replaceAll(`{${key}}`, `${literals[key]}`);
|
||||
const mutated = string.replaceAll(`{${key}}`, `${literals[key]}`);
|
||||
|
||||
if (dev && mutated === string) {
|
||||
console.warn(`Could not find literal {${key}} in string "${string}"`);
|
||||
}
|
||||
|
||||
string = mutated;
|
||||
}
|
||||
|
||||
return string;
|
||||
|
||||
Reference in new issue
Block a user