Skip to content

Commit

Permalink
fix escape filter with stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
jamelait authored and harttle committed Aug 25, 2019
1 parent aa15f3d commit e17bc97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/builtin/filters/html.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { stringify } from '../../util/underscore'

const escapeMap = {
'&': '&',
'<': '&lt;',
Expand All @@ -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) {
Expand Down

0 comments on commit e17bc97

Please sign in to comment.