diff --git a/source/app/metrics/utils.mjs b/source/app/metrics/utils.mjs index 44371ee0..cec8b551 100644 --- a/source/app/metrics/utils.mjs +++ b/source/app/metrics/utils.mjs @@ -86,6 +86,16 @@ .replace(/'/g, u["'"] ? "'" : "'") } +/**Unescape html */ + export function htmlunescape(string, u = {"&":true, "<":true, ">":true, '"':true, "'":true}) { + return string + .replace(/</g, u["<"] ? "<" : "<") + .replace(/>/g, u[">"] ? ">" : ">") + .replace(/"/g, u['"'] ? '"' : '"') + .replace(/'/g, u["'"] ? "'" : "'") + .replace(/&/g, u["&"] ? "&" : "&") + } + /**Run command */ export async function run(command, options, {prefixed = true} = {}) { const prefix = {win32:"wsl"}[process.platform] ?? ""