MCPcopy Create free account
hub / github.com/mdevils/html-entities / createHtml5EncodeMethods

Function createHtml5EncodeMethods

benchmark/benchmark.ts:31–45  ·  view source on GitHub ↗
(textToEncode: string)

Source from the content-addressed store, hash-verified

29}
30
31function createHtml5EncodeMethods(textToEncode: string) {
32 const heOptions = {useNamedReferences: true};
33 const nonAsciiPrintable: EncodeOptions = {level: 'html5', mode: 'nonAsciiPrintable'};
34 const extensive: EncodeOptions = {level: 'html5', mode: 'extensive'};
35 const nonAscii: EncodeOptions = {level: 'html5', mode: 'nonAscii'};
36 return {
37 'html-entities.encode - html5, nonAscii': () => encode(textToEncode, nonAscii),
38 'html-entities.encode - html5, nonAsciiPrintable': () => encode(textToEncode, nonAsciiPrintable),
39 'html-entities.encode - html5, extensive': () => encode(textToEncode, extensive),
40 '(old) Html5Entities.encodeNonASCII': () => html5Entities.encodeNonASCII(textToEncode),
41 'entities.encodeHTML': () => entities.encodeHTML(textToEncode),
42 'entities.encodeNonAsciiHTML': () => entities.encodeNonAsciiHTML(textToEncode),
43 'he.encode': () => he.encode(textToEncode, heOptions)
44 };
45}
46
47function createHtml5DecodeMethods(textToDecode: string) {
48 const strict: DecodeOptions = {level: 'html5', scope: 'strict'};

Callers 1

benchmark.tsFile · 0.85

Calls 3

encodeFunction · 0.90
encodeNonASCIIMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected