def escape_js(value: t.AnyStr) -> str:
"""Hex encodes characters for use in JavaScript strings.
:param value: String to be escaped.
:return: A string safe to be included inside a <script> tag.
"""
return str(value).translate(_js_escapes)
评论列表
文章目录