Skip to content

Commit 4831be9

Browse files
committed
docs(escape): fix stale JSDoc on escapeReplacer
1 parent 91e61ac commit 4831be9

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/decode.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ describe("Decode test", () => {
7171
});
7272

7373
describe("EntityDecoder", () => {
74-
let callback: ReturnType<typeof vi.fn<(cp: number, consumed: number) => void>>;
74+
let callback: ReturnType<
75+
typeof vi.fn<(cp: number, consumed: number) => void>
76+
>;
7577
let decoder: entities.EntityDecoder;
7678

7779
beforeEach(() => {

src/escape.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ export function encodeXML(input: string): string {
6868
export const escape: typeof encodeXML = encodeXML;
6969

7070
/**
71-
* Encodes all characters not valid in XML documents using XML entities.
71+
* Replacement callback used by {@link escapeUTF8}, {@link escapeAttribute},
72+
* and {@link escapeText} to map specific characters to their XML/HTML
73+
* entity representations.
7274
*
73-
* Note that the output will be character-set dependent.
74-
* @param c String to escape.
75+
* Converts `"`, `&`, `'`, `<`, `>`, and non-breaking space (`\u00A0`)
76+
* to their corresponding entities; returns all other characters unchanged.
77+
* @param c Single character match from the respective escape RegExp.
7578
*/
7679
function escapeReplacer(c: string): string {
7780
switch (c) {

0 commit comments

Comments
 (0)