Encodes a String. The characters &<>"'/ are encoded. If str is undefined or null an empty string will be returned.
&<>"'/
String that should be encoded
encoded String
import escape from "../string-escape";let escapedHtml = escape("hello <b>World</b>");escapedHtml === "hello <b>World</b>"; Copy
import escape from "../string-escape";let escapedHtml = escape("hello <b>World</b>");escapedHtml === "hello <b>World</b>";
Encodes a String. The characters
&<>"'/
are encoded. If str is undefined or null an empty string will be returned.