sanitize
import { sanitize } from "https://lilk6errxype3gpzga773pqnv4zzvc2v7locw2phzged227jyamq.arweave.net/WhavEjG-Hk2Z-TA__b4NrzOai1X63Ctp58mIPWvpwBk/mod.ts";
Sanitize &
, <
, >
and "
in string.
function sanitize(str?, { amp, lt, gt, quot }?: Record<string, boolean>): string;
§
sanitize(str?, { amp, lt, gt, quot }?: Record<string, boolean>): string
[src]§Return Type
§
string
[src]sanitized string
Use SanitizeOption like { amp: false }
to ignore sanitizing.
Examples:
import { sanitize } from "https://deno.land/x/markup_tag/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts"
// common usage
assertEquals(
sanitize(`<img src="https://www.example.com?width=10&height=10">`),
"<img src="https://www.example.com?width=10&height=10">",
);
// ignore sanitizing specific characters
assertEquals(sanitize("<br>", { lt: false, gt: false }), "<br>");