完善符号转义

pull/225/head
lyswhut 2020-03-28 10:42:46 +08:00
parent 9ed64354fc
commit 664a0e4ad8
1 changed files with 8 additions and 1 deletions

View File

@ -40,7 +40,14 @@ export const b64DecodeUnicode = str => {
}).join(''))
}
export const decodeName = str => str.replace(/'/g, '\'')
const encodeNames = {
'&': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&apos;': "'",
}
export const decodeName = str => str.replace(/(?:&amp;|&lt;|&gt;|&quot;|&apos;)/g, s => encodeNames[s])
const easeInOutQuad = (t, b, c, d) => {
t /= d / 2