@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function escape

    • Converts the characters "&", "<", ">", '"', and "'" in str to their corresponding HTML entities.

      str中的字符"&"、"<"、">"、'"'和"'"转换为对应的HTML实体。

      Parameters

      • str: string

        The string to escape. 要转义的字符串

      Returns string

      The escaped string. 转义后的字符串

      escape('<script>alert(1)</script>') // => &lt;script&gt;alert(1)&lt;/script&gt;