Qortal UI - Main Code Repository A User Interface for the Qortal Blockchain Project. Truly decentralized web hosting, application hosting, communications, data storage, and full infrastructure for the future global decentralized digital world.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

16 lines
561 B

export function interpolate(text, values, config) {
return Object.entries(extract(values || {})).reduce((text, [key, value]) => text.replace(new RegExp(`{{[  ]*${key}[  ]*}}`, `gm`), String(extract(value))), text)
}
export function lookup(key, config) {
const parts = key.split(".")
let string = config.strings
while (string != null && parts.length > 0) {
string = string[parts.shift()]
}
return string != null ? string.toString() : null
}
export function extract(obj) {
return (typeof obj === "function") ? obj() : obj
}