def _js_string_filter(value):
 string = json.dumps(value)
 replacements = [('\\', '\\\\'), ('"', '\\"'), ("'", "\\'"), ('\n', '\\n'), ('\r', '\\r'), ('\x08', '\\b'), ('<', '\\u003c'), ('>', '\\u003e'), ('&', '\\u0026')]
 for replacement in replacements:
  string = string.replace(replacement[0], replacement[1])
 return jinja2.utils.Markup(string)

def _js_string_filter ( value ) : string = json . dumps ( value ) replacements = [ ( '\\' , '\\\\' ) , ( '"' , '\\"' ) , ( "'" , "\\'" ) , ( '\n' , '\\n' ) , ( '\r' , '\\r' ) , ( '\x08' , '\\b' ) , ( '<' , '\\u003c' ) , ( '>' , '\\u003e' ) , ( '&' , '\\u0026' ) ] for replacement in replacements : string = string . replace ( replacement [ 0 ] , replacement [ 1 ] ) return jinja2 . utils . Markup ( string )
converts a value to a json string for use in javascript code .