RubyLouvre/avalon

View on GitHub
src/filters/escape.js

Summary

Maintainability
A
0 mins
Test Coverage
//https://github.com/teppeis/htmlspecialchars
export function escapeFilter(str) {
    if (str == null)
        return ''

    return String(str).
        replace(/&/g, '&').
        replace(/</g, '&lt;').
        replace(/>/g, '&gt;').
        replace(/"/g, '&quot;').
        replace(/'/g, '&#39;')
}