1+ /* eslint-disable node/no-missing-import */
12import * as entities from "../" ;
23import he from "he" ;
3- // @ts -ignore
4- import htmlEscaper from "html-escaper" ;
54import parseEntities from "parse-entities" ;
65import * as htmlEntities from "html-entities" ;
76
@@ -10,8 +9,6 @@ const RUNS = 1e7;
109const encoders : [ string , ( str : string ) => string ] [ ] = [
1110 [ "entities" , ( str : string ) => entities . encodeHTML ( str ) ] ,
1211 [ "he" , ( str : string ) => he . encode ( str ) ] ,
13- // Only escapes the source.
14- // ["html-escaper", (str: string) => htmlEscaper.escape(str)],
1512 [
1613 "html-entities" ,
1714 ( str : string ) => htmlEntities . AllHtmlEntities . encode ( str ) ,
@@ -21,22 +18,21 @@ const encoders: [string, (str: string) => string][] = [
2118const decoders : [ string , ( str : string ) => string ] [ ] = [
2219 [ "entities" , ( str : string ) => entities . decodeHTML ( str ) ] ,
2320 [ "he" , ( str : string ) => he . decode ( str ) ] ,
24- // html-escaper does not produce correct output
25- // ["html-escaper", (str: string) => htmlEscaper.unescape(str)],
2621 [ "parse-entities" , ( str : string ) => parseEntities ( str ) ] ,
2722 [
2823 "html-entities" ,
2924 ( str : string ) => htmlEntities . AllHtmlEntities . decode ( str ) ,
3025 ] ,
3126] ;
3227
33- // Note: Not shown on the README, as `entities` differs in behavior from other libraries.
34- // `entities` produces ASCII output, while other libraries only escape characters.
28+ /*
29+ * Note: Not shown on the README, as `entities` differs in behavior from other libraries.
30+ * `entities` produces ASCII output, while other libraries only escape characters.
31+ */
3532const escapers : [ string , ( str : string ) => string ] [ ] = [
3633 [ "entities" , ( str : string ) => entities . encodeXML ( str ) ] ,
3734 [ "he" , ( str : string ) => he . escape ( str ) ] ,
38- [ "html-escaper" , ( str : string ) => htmlEscaper . escape ( str ) ] ,
39- // html-entities cannot escape, so we use its simplest mode.
35+ // Html-entities cannot escape, so we use its simplest mode.
4036 [ "html-entities" , ( str : string ) => htmlEntities . XmlEntities . encode ( str ) ] ,
4137] ;
4238
0 commit comments