mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
fix escape filter with stringify
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { stringify } from '../../util/underscore'
|
||||
|
||||
const escapeMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
@@ -14,7 +16,7 @@ const unescapeMap = {
|
||||
}
|
||||
|
||||
function escape (str: string) {
|
||||
return str ? String(str).replace(/&|<|>|"|'/g, m => escapeMap[m]) : ''
|
||||
return stringify(str).replace(/&|<|>|"|'/g, m => escapeMap[m])
|
||||
}
|
||||
|
||||
function unescape (str: string) {
|
||||
|
||||
Reference in New Issue
Block a user