Skip to main content
variable escapeHTML
import { escapeHTML } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Escapes a string for use in HTML.

Use String.prototype.replace() with a regexp that matches the characters that need to be escaped, using a callback function to replace each character instance with its associated escaped character using a dictionary (object).

type

(str: string) => unknown