@mcaskill/html-build-attributes/value/escape-html-entities.js
The function converts the following characters in a string to their
corresponding HTML entities: &
, <
, >
, "
, '
, and `
.
escapeHTMLEntities(string: string): string
import {
escapeHTMLEntities
} from '@mcaskill/html-build-attributes/value/escape-html-entities.js';
escapeHTMLEntities('{"id":1,"name":"Tim"}');
// → {"id":1,"name":"Tim"}
escapeHTMLEntities('<img>');
// → <img>