Add html unescape function
This commit is contained in:
@@ -86,6 +86,16 @@
|
|||||||
.replace(/'/g, u["'"] ? "'" : "'")
|
.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 */
|
/**Run command */
|
||||||
export async function run(command, options, {prefixed = true} = {}) {
|
export async function run(command, options, {prefixed = true} = {}) {
|
||||||
const prefix = {win32:"wsl"}[process.platform] ?? ""
|
const prefix = {win32:"wsl"}[process.platform] ?? ""
|
||||||
|
|||||||
Reference in New Issue
Block a user