code: def wash_for_js(text):
      
      from invenio_utils.html import escape_javascript_string
      if isinstance(text, six.string_types):
          return '"%s"' % escape_javascript_string(
              text,
              escape_for_html=False,
              escape_CDATA=False,
              escape_script_tag_with_quote=None)
      else:
          return text
docs: DEPRECATED: use htmlutils.escape_javascript_string() instead,
      and take note that returned value is no longer enclosed into
      quotes.