Function escapeHTML

  • Escape the following characters in a string:

    • " becomes """
    • & becomes "&"
    • ' becomes "'"
    • < becomes "&lt;"
    • > becomes "&gt;"

    This function is optimized for large input. On an M1X, it processes 480 MB/s - 20 GB/s, depending on how much data is being escaped and whether there is non-ascii text.

    Non-string types will be converted to a string before escaping.

    Parameters

    • input: string | number | boolean | object

    Returns string

  • Escape the following characters in a string:

    • " becomes "&quot;"
    • & becomes "&amp;"
    • ' becomes "&#x27;"
    • < becomes "&lt;"
    • > becomes "&gt;"

    This function is optimized for large input. On an M1X, it processes 480 MB/s - 20 GB/s, depending on how much data is being escaped and whether there is non-ascii text.

    Non-string types will be converted to a string before escaping.

    Parameters

    • input: string | number | boolean | object

    Returns string

Generated using TypeDoc