Add html unescape function
This commit is contained in:
@@ -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] ?? ""
|
||||
|
||||
Reference in New Issue
Block a user