@cjser/html-escaper 3.0.3-cjser.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # html-escaper
2
+
3
+ [![Downloads](https://img.shields.io/npm/dm/html-escaper.svg)](https://www.npmjs.com/package/html-escaper) [![Build Status](https://travis-ci.org/WebReflection/html-escaper.svg?branch=master)](https://travis-ci.org/WebReflection/html-escaper) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/html-escaper/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/html-escaper?branch=master) ![WebReflection status](https://offline.report/status/webreflection.svg)
4
+
5
+ A simple module to escape/unescape common problematic entities.
6
+
7
+ #### Go sloppy if you like!
8
+
9
+ If you'd like to deal with any kind of input, including `null` or `undefined`, and even `symbol` kind, check [html-sloppy-escaper](https://www.npmjs.com/package/html-sloppy-escaper) out: it's this very same module, except it never throws errors 👍
10
+
11
+
12
+ ## V3 ESM Only Release
13
+
14
+ The version 3 of this module ditches entirely legacy browsers and _nodejs_ with broken loaders, such as `v13.0.0` and `v13.1.0`.
15
+
16
+ As the code is basically identical, simply stick with version 2 if you have any issue with this one 👋
17
+
18
+
19
+ ### How
20
+ This package is available in npm so `npm install html-escaper` is all you need to do, using eventually the global flag too.
21
+
22
+ Once the module is present
23
+ ```js
24
+ import {escape, unescape} from 'html-escaper';
25
+
26
+ escape('string');
27
+ unescape('escaped string');
28
+ ```
29
+
30
+
31
+ ### Why
32
+ there is basically one rule only: do not **ever** replace one char after another if you are transforming a string into another.
33
+
34
+ ```js
35
+ // WARNING: THIS IS WRONG
36
+ // if you are that kind of dev that does this
37
+ function escape(s) {
38
+ return s.replace(/&/g, "&")
39
+ .replace(/</g, "&lt;")
40
+ .replace(/>/g, "&gt;")
41
+ .replace(/'/g, "&#39;")
42
+ .replace(/"/g, "&quot;");
43
+ }
44
+
45
+ // you might be the same dev that does this too
46
+ function unescape(s) {
47
+ return s.replace(/&amp;/g, "&")
48
+ .replace(/&lt;/g, "<")
49
+ .replace(/&gt;/g, ">")
50
+ .replace(/&#39;/g, "'")
51
+ .replace(/&quot;/g, '"');
52
+ }
53
+
54
+ // guess what we have here ?
55
+ unescape('&amp;lt;');
56
+
57
+ // now guess this XSS too ...
58
+ unescape('&amp;lt;script&amp;gt;alert("yo")&amp;lt;/script&amp;gt;');
59
+
60
+
61
+ ```
62
+
63
+ The last example will produce `<script>alert("yo")</script>` instead of the expected `&lt;script&gt;alert("yo")&lt;/script&gt;`.
64
+
65
+ Nothing like this could possibly happen if we grab all chars at once and either ways.
66
+ It's just a fortunate case that after swapping `&` with `&amp;` no other replace will be affected, but it's not portable and universally a bad practice.
67
+
68
+ Grab all chars at once, no excuses!
69
+
70
+
71
+
72
+ **more details**
73
+ As somebody might think it's an `unescape` issue only, it's not. Being an anti-pattern with side effects works both ways.
74
+
75
+ As example, changing the order of the replacement in escaping would produce the unexpected:
76
+ ```js
77
+ function escape(s) {
78
+ return s.replace(/</g, "&lt;")
79
+ .replace(/>/g, "&gt;")
80
+ .replace(/'/g, "&#39;")
81
+ .replace(/"/g, "&quot;")
82
+ .replace(/&/g, "&amp;");
83
+ }
84
+
85
+ escape('<'); // &amp;lt; instead of &lt;
86
+ ```
87
+ If we do not want to code with the fear that the order wasn't perfect or that our order in either escaping or unescaping is different from the order another method or function used, if we understand the issue and we agree it's potentially a disaster prone approach, if we add the fact in this case creating 4 RegExp objects each time and invoking 4 times `.replace` trough the `String.prototype` is also potentially slower than creating one function only holding one object, or holding the function too, we should agree there is not absolutely any valid reason to keep proposing a char-by-char implementation.
88
+
89
+ We have proofs this approach can fail already so ... why should we risk? Just avoid and grab all chars at once or simply use this tiny utility.
90
+
91
+ ### Backtick
92
+ Internt explorer < 9 has [some backtick issue](https://html5sec.org/#102)
93
+
94
+ For compatibility sake with common server-side HTML entities encoders and decoders, and in order to have the most reliable I/O, this little utility will NOT fix this IE < 9 problem.
95
+
96
+ It is also important to note that if we create valid HTML and we set attributes at runtime through this utility, backticks in strings cannot possibly affect attribute behaviors.
97
+
98
+ ```js
99
+ var img = new Image();
100
+ img.src = html.escape(
101
+ 'x` `<script>alert(1)</script>"` `'
102
+ );
103
+ // it won't cause problems even in IE < 9
104
+ ```
105
+
106
+ **However**, if you use `innerHTML` and you target IE < 9 then [this **might** be a problem](https://github.com/nette/nette/issues/1496).
107
+
108
+ Accordingly, if you need more chars and/or backticks to be escaped and unescaped, feel free to use alternatives like [lodash](https://github.com/lodash/lodash) or [he](https://www.npmjs.com/package/he)
109
+
110
+ Here a bit more of [my POV](https://github.com/WebReflection/html-escaper/commit/52d554fc6e8583b6ffdd357967cf71962fc07cf6#commitcomment-10625122) and why I haven't implemented same thing alternatives did. Good news: those are alternatives ;-)
111
+
112
+ ## cjser
113
+
114
+ This package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
115
+ Original repository: https://github.com/WebReflection/html-escaper
package/cjs/index.js ADDED
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+ /**
3
+ * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ * THE SOFTWARE.
22
+ */
23
+
24
+ const {replace} = '';
25
+
26
+ // escape
27
+ const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
28
+ const ca = /[&<>'"]/g;
29
+
30
+ const esca = {
31
+ '&': '&amp;',
32
+ '<': '&lt;',
33
+ '>': '&gt;',
34
+ "'": '&#39;',
35
+ '"': '&quot;'
36
+ };
37
+ const pe = m => esca[m];
38
+
39
+ /**
40
+ * Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
41
+ * @param {string} es the input to safely escape
42
+ * @returns {string} the escaped input, and it **throws** an error if
43
+ * the input type is unexpected, except for boolean and numbers,
44
+ * converted as string.
45
+ */
46
+ const escape = es => replace.call(es, ca, pe);
47
+ exports.escape = escape;
48
+
49
+
50
+ // unescape
51
+ const unes = {
52
+ '&amp;': '&',
53
+ '&#38;': '&',
54
+ '&lt;': '<',
55
+ '&#60;': '<',
56
+ '&gt;': '>',
57
+ '&#62;': '>',
58
+ '&apos;': "'",
59
+ '&#39;': "'",
60
+ '&quot;': '"',
61
+ '&#34;': '"'
62
+ };
63
+ const cape = m => unes[m];
64
+
65
+ /**
66
+ * Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`,
67
+ * and `'`.
68
+ * @param {string} un a previously escaped string
69
+ * @returns {string} the unescaped input, and it **throws** an error if
70
+ * the input type is unexpected, except for boolean and numbers,
71
+ * converted as string.
72
+ */
73
+ const unescape = un => replace.call(un, es, cape);
74
+ exports.unescape = unescape;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,56 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/@cjser/html-escaper.tmp-26-1789317420938/esm/index.js
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ escape: () => escape,
23
+ unescape: () => unescape
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var { replace } = "";
27
+ var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
28
+ var ca = /[&<>'"]/g;
29
+ var esca = {
30
+ "&": "&amp;",
31
+ "<": "&lt;",
32
+ ">": "&gt;",
33
+ "'": "&#39;",
34
+ '"': "&quot;"
35
+ };
36
+ var pe = (m) => esca[m];
37
+ var escape = (es2) => replace.call(es2, ca, pe);
38
+ var unes = {
39
+ "&amp;": "&",
40
+ "&#38;": "&",
41
+ "&lt;": "<",
42
+ "&#60;": "<",
43
+ "&gt;": ">",
44
+ "&#62;": ">",
45
+ "&apos;": "'",
46
+ "&#39;": "'",
47
+ "&quot;": '"',
48
+ "&#34;": '"'
49
+ };
50
+ var cape = (m) => unes[m];
51
+ var unescape = (un) => replace.call(un, es, cape);
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ escape,
55
+ unescape
56
+ });
package/esm/index.js ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ * THE SOFTWARE.
21
+ */
22
+
23
+ const {replace} = '';
24
+
25
+ // escape
26
+ const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
27
+ const ca = /[&<>'"]/g;
28
+
29
+ const esca = {
30
+ '&': '&amp;',
31
+ '<': '&lt;',
32
+ '>': '&gt;',
33
+ "'": '&#39;',
34
+ '"': '&quot;'
35
+ };
36
+ const pe = m => esca[m];
37
+
38
+ /**
39
+ * Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
40
+ * @param {string} es the input to safely escape
41
+ * @returns {string} the escaped input, and it **throws** an error if
42
+ * the input type is unexpected, except for boolean and numbers,
43
+ * converted as string.
44
+ */
45
+ export const escape = es => replace.call(es, ca, pe);
46
+
47
+
48
+ // unescape
49
+ const unes = {
50
+ '&amp;': '&',
51
+ '&#38;': '&',
52
+ '&lt;': '<',
53
+ '&#60;': '<',
54
+ '&gt;': '>',
55
+ '&#62;': '>',
56
+ '&apos;': "'",
57
+ '&#39;': "'",
58
+ '&quot;': '"',
59
+ '&#34;': '"'
60
+ };
61
+ const cape = m => unes[m];
62
+
63
+ /**
64
+ * Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`,
65
+ * and `'`.
66
+ * @param {string} un a previously escaped string
67
+ * @returns {string} the unescaped input, and it **throws** an error if
68
+ * the input type is unexpected, except for boolean and numbers,
69
+ * converted as string.
70
+ */
71
+ export const unescape = un => replace.call(un, es, cape);
package/index.js ADDED
@@ -0,0 +1,81 @@
1
+ var html = (function (exports) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+
26
+ const {replace} = '';
27
+
28
+ // escape
29
+ const es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
30
+ const ca = /[&<>'"]/g;
31
+
32
+ const esca = {
33
+ '&': '&amp;',
34
+ '<': '&lt;',
35
+ '>': '&gt;',
36
+ "'": '&#39;',
37
+ '"': '&quot;'
38
+ };
39
+ const pe = m => esca[m];
40
+
41
+ /**
42
+ * Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`.
43
+ * @param {string} es the input to safely escape
44
+ * @returns {string} the escaped input, and it **throws** an error if
45
+ * the input type is unexpected, except for boolean and numbers,
46
+ * converted as string.
47
+ */
48
+ const escape = es => replace.call(es, ca, pe);
49
+
50
+
51
+ // unescape
52
+ const unes = {
53
+ '&amp;': '&',
54
+ '&#38;': '&',
55
+ '&lt;': '<',
56
+ '&#60;': '<',
57
+ '&gt;': '>',
58
+ '&#62;': '>',
59
+ '&apos;': "'",
60
+ '&#39;': "'",
61
+ '&quot;': '"',
62
+ '&#34;': '"'
63
+ };
64
+ const cape = m => unes[m];
65
+
66
+ /**
67
+ * Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`,
68
+ * and `'`.
69
+ * @param {string} un a previously escaped string
70
+ * @returns {string} the unescaped input, and it **throws** an error if
71
+ * the input type is unexpected, except for boolean and numbers,
72
+ * converted as string.
73
+ */
74
+ const unescape = un => replace.call(un, es, cape);
75
+
76
+ exports.escape = escape;
77
+ exports.unescape = unescape;
78
+
79
+ return exports;
80
+
81
+ }({}));
package/min.js ADDED
@@ -0,0 +1 @@
1
+ var html=function(t){"use strict";const{replace:a}="",l=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g,c=/[&<>'"]/g,e={"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"},p=t=>e[t],o={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"'},s=t=>o[t];return t.escape=(t=>a.call(t,c,p)),t.unescape=(t=>a.call(t,l,s)),t}({});
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@cjser/html-escaper",
3
+ "version": "3.0.3-cjser.2",
4
+ "description": "fast and safe way to escape and unescape &<>'\" chars",
5
+ "main": "./dist-cjser/index.cjs",
6
+ "unpkg": "min.js",
7
+ "scripts": {
8
+ "build": "npm run cjs && npm run rollup && npm run minify && npm test && npm run size",
9
+ "cjs": "ascjs esm cjs",
10
+ "coveralls": "c8 report --reporter=text-lcov | coveralls",
11
+ "minify": "uglifyjs index.js --comments=/^!/ --compress --mangle -o min.js",
12
+ "rollup": "rollup --config rollup.config.js",
13
+ "size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c min.js | wc -c",
14
+ "test": "c8 node ./test/index.js"
15
+ },
16
+ "module": "./esm/index.js",
17
+ "type": "module",
18
+ "exports": {
19
+ "require": "./dist-cjser/index.cjs",
20
+ "import": "./esm/index.js",
21
+ "default": "./cjs/index.js"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://code.moenext.com/3rdeye/cjser.git"
26
+ },
27
+ "keywords": [
28
+ "html",
29
+ "escape",
30
+ "encode",
31
+ "unescape",
32
+ "decode",
33
+ "entities"
34
+ ],
35
+ "author": "Andrea Giammarchi",
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/WebReflection/html-escaper/issues"
39
+ },
40
+ "homepage": "https://github.com/WebReflection/html-escaper",
41
+ "devDependencies": {
42
+ "ascjs": "^5.0.1",
43
+ "c8": "^7.6.0",
44
+ "coveralls": "^3.1.0",
45
+ "rollup": "^2.39.0",
46
+ "uglify-es": "^3.3.9"
47
+ },
48
+ "cjser": {
49
+ "sourceVersion": "3.0.3",
50
+ "cjserVersion": 2,
51
+ "original": {
52
+ "name": "html-escaper",
53
+ "version": "3.0.3",
54
+ "main": "./cjs/index.js",
55
+ "exports": {
56
+ "import": "./esm/index.js",
57
+ "default": "./cjs/index.js"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/WebReflection/html-escaper.git"
62
+ },
63
+ "scripts": {
64
+ "build": "npm run cjs && npm run rollup && npm run minify && npm test && npm run size",
65
+ "cjs": "ascjs esm cjs",
66
+ "coveralls": "c8 report --reporter=text-lcov | coveralls",
67
+ "minify": "uglifyjs index.js --comments=/^!/ --compress --mangle -o min.js",
68
+ "rollup": "rollup --config rollup.config.js",
69
+ "size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c min.js | wc -c",
70
+ "test": "c8 node ./test/index.js"
71
+ }
72
+ }
73
+ }
74
+ }
package/test/index.js ADDED
@@ -0,0 +1,23 @@
1
+ delete Object.freeze;
2
+
3
+ var html = require('../cjs');
4
+
5
+ console.assert(
6
+ html.escape('&<>\'"') === '&amp;&lt;&gt;&#39;&quot;',
7
+ 'correct escape'
8
+ );
9
+
10
+ console.assert(
11
+ html.escape('<>\'"&') === '&lt;&gt;&#39;&quot;&amp;',
12
+ 'correct inverted escape'
13
+ );
14
+
15
+ console.assert(
16
+ '&<>\'"' === html.unescape('&amp;&lt;&gt;&#39;&quot;'),
17
+ 'correct unescape'
18
+ );
19
+
20
+ console.assert(
21
+ '<>\'"&' === html.unescape('&lt;&gt;&#39;&quot;&amp;'),
22
+ 'correct inverted unescape'
23
+ );
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}