Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Latest commit

 

History

History
23 lines (16 loc) · 433 Bytes

string_escape_html.md

File metadata and controls

23 lines (16 loc) · 433 Bytes

strings/stringEscapeHTML

Converts HTML special characters into entities.

function stringEscapeHTML(str: string): string

Args

str:string
The string to escape.

Returns

The string with special HTML characters replaced by entities.

Examples

import { stringEscapeHTML } from 'utils/strings';

console.log(stringEscapeHTML('<a>foo</a>')); // Outputs: '&lt;a&gt;foo&lt;/a&gt;'