Skip to content

Commit e17bc97

Browse files
jamelaitharttle
jamelait
authored andcommitted
fix escape filter with stringify
1 parent aa15f3d commit e17bc97

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/builtin/filters/html.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { stringify } from '../../util/underscore'
2+
13
const escapeMap = {
24
'&': '&',
35
'<': '&lt;',
@@ -14,7 +16,7 @@ const unescapeMap = {
1416
}
1517

1618
function escape (str: string) {
17-
return str ? String(str).replace(/&|<|>|"|'/g, m => escapeMap[m]) : ''
19+
return stringify(str).replace(/&|<|>|"|'/g, m => escapeMap[m])
1820
}
1921

2022
function unescape (str: string) {

0 commit comments

Comments
 (0)