@webex/helper-html 2.59.3-next.1 → 2.59.4

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/.eslintrc.js CHANGED
@@ -1,6 +1,6 @@
1
- const config = {
2
- root: true,
3
- extends: ['@webex/eslint-config-legacy'],
4
- };
5
-
6
- module.exports = config;
1
+ const config = {
2
+ root: true,
3
+ extends: ['@webex/eslint-config-legacy'],
4
+ };
5
+
6
+ module.exports = config;
package/README.md CHANGED
@@ -1,62 +1,62 @@
1
- # @webex/helper-html
2
-
3
- [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
-
5
- > HTML filter for the Cisco Webex JS SDK. See https://webex.github.io/webex-js-sdk/
6
-
7
- Note: This package relies on DOM apis and largely returns noops in node environments.
8
-
9
- - [Install](#install)
10
- - [Usage](#usage)
11
- - [Contribute](#contribute)
12
- - [Maintainers](#maintainers)
13
- - [License](#license)
14
-
15
- ## Install
16
-
17
- ```bash
18
- npm install --save @webex/helper-html
19
- ```
20
-
21
- ## Usage
22
-
23
- ### `filter(allowedTags, allowedStyles, html)`
24
-
25
- Filters an html string such that it only includes the allowed tags and styles. Disallowed tags and styles are removed while their contents are kept.
26
-
27
- `allowedTags` is an object keyed on tag name mapped to an array of attribuets allowed for that tag.
28
- `allwedStyles` is an array of allowed style string.
29
- `html` is a string.
30
-
31
- Returns a promise that resolves with the new html string.
32
-
33
- ### `filterSync()`
34
-
35
- See `filter()`
36
-
37
- ### `filterEscape(processCallback, allowedTags, allowedStyles, html)`
38
-
39
- Filters an html string such that it only includes the allowed tags and styles. Disallowed tags and styles and their children are escaped.
40
-
41
- `processCallback` synchronous callback that receives the body of the html fragment generated from `html`. Presents an opportunity to do preprocessing (e.g turn urls into links) without parsing html `mulitple` times
42
- `allowedTags` is an object keyed on tag name mapped to an array of attribuets allowed for that tag.
43
- `allwedStyles` is an array of allowed style string.
44
- `html` is a string.
45
-
46
- Returns a promise that resolves with the new html string.
47
-
48
- ### `filterEscapeSync()`
49
-
50
- See `filterEscape()`
51
-
52
- ## Maintainers
53
-
54
- This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
55
-
56
- ## Contribute
57
-
58
- Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
59
-
60
- ## License
61
-
62
- © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
1
+ # @webex/helper-html
2
+
3
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
+
5
+ > HTML filter for the Cisco Webex JS SDK. See https://webex.github.io/webex-js-sdk/
6
+
7
+ Note: This package relies on DOM apis and largely returns noops in node environments.
8
+
9
+ - [Install](#install)
10
+ - [Usage](#usage)
11
+ - [Contribute](#contribute)
12
+ - [Maintainers](#maintainers)
13
+ - [License](#license)
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ npm install --save @webex/helper-html
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### `filter(allowedTags, allowedStyles, html)`
24
+
25
+ Filters an html string such that it only includes the allowed tags and styles. Disallowed tags and styles are removed while their contents are kept.
26
+
27
+ `allowedTags` is an object keyed on tag name mapped to an array of attribuets allowed for that tag.
28
+ `allwedStyles` is an array of allowed style string.
29
+ `html` is a string.
30
+
31
+ Returns a promise that resolves with the new html string.
32
+
33
+ ### `filterSync()`
34
+
35
+ See `filter()`
36
+
37
+ ### `filterEscape(processCallback, allowedTags, allowedStyles, html)`
38
+
39
+ Filters an html string such that it only includes the allowed tags and styles. Disallowed tags and styles and their children are escaped.
40
+
41
+ `processCallback` synchronous callback that receives the body of the html fragment generated from `html`. Presents an opportunity to do preprocessing (e.g turn urls into links) without parsing html `mulitple` times
42
+ `allowedTags` is an object keyed on tag name mapped to an array of attribuets allowed for that tag.
43
+ `allwedStyles` is an array of allowed style string.
44
+ `html` is a string.
45
+
46
+ Returns a promise that resolves with the new html string.
47
+
48
+ ### `filterEscapeSync()`
49
+
50
+ See `filterEscape()`
51
+
52
+ ## Maintainers
53
+
54
+ This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
55
+
56
+ ## Contribute
57
+
58
+ Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
59
+
60
+ ## License
61
+
62
+ © 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
package/babel.config.js CHANGED
@@ -1,3 +1,3 @@
1
- const babelConfigLegacy = require('@webex/babel-config-legacy');
2
-
3
- module.exports = babelConfigLegacy;
1
+ const babelConfigLegacy = require('@webex/babel-config-legacy');
2
+
3
+ module.exports = babelConfigLegacy;
package/browsers.js CHANGED
@@ -1,18 +1,18 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- /* eslint-disable */
6
-
7
- 'use strict';
8
-
9
- module.exports = function (browsers) {
10
- // For reasons as-yet unexplained, the html filter test suite hangs when run
11
- // on Safari/Sauce Labs
12
- Object.keys(browsers).forEach(function (key) {
13
- if (key.indexOf('safari') !== -1) {
14
- delete browsers[key];
15
- }
16
- });
17
- return browsers;
18
- };
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ /* eslint-disable */
6
+
7
+ 'use strict';
8
+
9
+ module.exports = function (browsers) {
10
+ // For reasons as-yet unexplained, the html filter test suite hangs when run
11
+ // on Safari/Sauce Labs
12
+ Object.keys(browsers).forEach(function (key) {
13
+ if (key.indexOf('safari') !== -1) {
14
+ delete browsers[key];
15
+ }
16
+ });
17
+ return browsers;
18
+ };
package/dist/html-base.js CHANGED
@@ -8,8 +8,8 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  exports.escape = escape;
9
9
  exports.escapeSync = escapeSync;
10
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
- /*!
12
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
11
+ /*!
12
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
13
13
  */
14
14
 
15
15
  var escapeMe = /(<|>|&)/g;
@@ -17,10 +17,10 @@ var escapeMe = /(<|>|&)/g;
17
17
  // escape and escapeSync probably don't both need to exist, but it seemed like a
18
18
  // good idea in case we ever want to for the future.
19
19
 
20
- /**
21
- * Escapes HTML
22
- * @param {[type]} html
23
- * @returns {[type]}
20
+ /**
21
+ * Escapes HTML
22
+ * @param {[type]} html
23
+ * @returns {[type]}
24
24
  */
25
25
  function escape(html) {
26
26
  return new _promise.default(function (resolve) {
@@ -28,19 +28,19 @@ function escape(html) {
28
28
  });
29
29
  }
30
30
 
31
- /**
32
- * Synchronously escape HTML
33
- * @param {[type]} html
34
- * @returns {[type]}
31
+ /**
32
+ * Synchronously escape HTML
33
+ * @param {[type]} html
34
+ * @returns {[type]}
35
35
  */
36
36
  function escapeSync(html) {
37
37
  return html.replace(escapeMe, entityReplacer);
38
38
  }
39
39
 
40
- /**
41
- * @param {string} char
42
- * @private
43
- * @returns {string}
40
+ /**
41
+ * @param {string} char
42
+ * @private
43
+ * @returns {string}
44
44
  */
45
45
  function entityReplacer(char) {
46
46
  switch (char) {
@@ -1 +1 @@
1
- {"version":3,"names":["escapeMe","escape","html","_promise","default","resolve","escapeSync","replace","entityReplacer","char"],"sources":["html-base.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nconst escapeMe = /(<|>|&)/g;\r\n\r\n// escape and escapeSync probably don't both need to exist, but it seemed like a\r\n// good idea in case we ever want to for the future.\r\n\r\n/**\r\n * Escapes HTML\r\n * @param {[type]} html\r\n * @returns {[type]}\r\n */\r\nexport function escape(html) {\r\n return new Promise((resolve) => resolve(escapeSync(html)));\r\n}\r\n\r\n/**\r\n * Synchronously escape HTML\r\n * @param {[type]} html\r\n * @returns {[type]}\r\n */\r\nexport function escapeSync(html) {\r\n return html.replace(escapeMe, entityReplacer);\r\n}\r\n\r\n/**\r\n * @param {string} char\r\n * @private\r\n * @returns {string}\r\n */\r\nfunction entityReplacer(char) {\r\n switch (char) {\r\n case '<':\r\n return '&lt;';\r\n case '>':\r\n return '&gt;';\r\n case '&':\r\n return '&amp;';\r\n default:\r\n return char;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAEA,IAAMA,QAAQ,GAAG,UAAU;;AAE3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,MAAMA,CAACC,IAAI,EAAE;EAC3B,OAAO,IAAAC,QAAA,CAAAC,OAAA,CAAY,UAACC,OAAO;IAAA,OAAKA,OAAO,CAACC,UAAU,CAACJ,IAAI,CAAC,CAAC;EAAA,EAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASI,UAAUA,CAACJ,IAAI,EAAE;EAC/B,OAAOA,IAAI,CAACK,OAAO,CAACP,QAAQ,EAAEQ,cAAc,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAcA,CAACC,IAAI,EAAE;EAC5B,QAAQA,IAAI;IACV,KAAK,GAAG;MACN,OAAO,MAAM;IACf,KAAK,GAAG;MACN,OAAO,MAAM;IACf,KAAK,GAAG;MACN,OAAO,OAAO;IAChB;MACE,OAAOA,IAAI;EAAC;AAElB"}
1
+ {"version":3,"names":["escapeMe","escape","html","_promise","default","resolve","escapeSync","replace","entityReplacer","char"],"sources":["html-base.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nconst escapeMe = /(<|>|&)/g;\n\n// escape and escapeSync probably don't both need to exist, but it seemed like a\n// good idea in case we ever want to for the future.\n\n/**\n * Escapes HTML\n * @param {[type]} html\n * @returns {[type]}\n */\nexport function escape(html) {\n return new Promise((resolve) => resolve(escapeSync(html)));\n}\n\n/**\n * Synchronously escape HTML\n * @param {[type]} html\n * @returns {[type]}\n */\nexport function escapeSync(html) {\n return html.replace(escapeMe, entityReplacer);\n}\n\n/**\n * @param {string} char\n * @private\n * @returns {string}\n */\nfunction entityReplacer(char) {\n switch (char) {\n case '<':\n return '&lt;';\n case '>':\n return '&gt;';\n case '&':\n return '&amp;';\n default:\n return char;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;;AAEA,IAAMA,QAAQ,GAAG,UAAU;;AAE3B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,MAAMA,CAACC,IAAI,EAAE;EAC3B,OAAO,IAAAC,QAAA,CAAAC,OAAA,CAAY,UAACC,OAAO;IAAA,OAAKA,OAAO,CAACC,UAAU,CAACJ,IAAI,CAAC,CAAC;EAAA,EAAC;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASI,UAAUA,CAACJ,IAAI,EAAE;EAC/B,OAAOA,IAAI,CAACK,OAAO,CAACP,QAAQ,EAAEQ,cAAc,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAcA,CAACC,IAAI,EAAE;EAC5B,QAAQA,IAAI;IACV,KAAK,GAAG;MACN,OAAO,MAAM;IACf,KAAK,GAAG;MACN,OAAO,MAAM;IACf,KAAK,GAAG;MACN,OAAO,OAAO;IAChB;MACE,OAAOA,IAAI;EAAC;AAElB"}
package/dist/html.js CHANGED
@@ -21,12 +21,12 @@ exports.filterSync = exports.filterEscapeSync = exports.filterEscape = exports.f
21
21
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
22
22
  var _curry2 = _interopRequireDefault(require("lodash/curry"));
23
23
  var _htmlBase = require("./html-base");
24
- /**
25
- * @param {Object} allowedTags
26
- * @param {Array<string>} allowedStyles
27
- * @param {string} html
28
- * @private
29
- * @returns {string}
24
+ /**
25
+ * @param {Object} allowedTags
26
+ * @param {Array<string>} allowedStyles
27
+ * @param {string} html
28
+ * @private
29
+ * @returns {string}
30
30
  */
31
31
  function noop() {
32
32
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -37,14 +37,14 @@ function noop() {
37
37
  });
38
38
  }
39
39
 
40
- /**
41
- * @param {function} processCallback callback function to do additional
42
- * processing on node. of the form process(node)
43
- * @param {Object} allowedTags
44
- * @param {Array<string>} allowedStyles
45
- * @param {string} html
46
- * @private
47
- * @returns {string}
40
+ /**
41
+ * @param {function} processCallback callback function to do additional
42
+ * processing on node. of the form process(node)
43
+ * @param {Object} allowedTags
44
+ * @param {Array<string>} allowedStyles
45
+ * @param {string} html
46
+ * @private
47
+ * @returns {string}
48
48
  */
49
49
  function noopSync(processCallback, allowedTags, allowedStyles, html) {
50
50
  return html;
package/dist/html.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_htmlBase","require","noop","_len","arguments","length","args","Array","_key","_promise","default","resolve","noopSync","apply","processCallback","allowedTags","allowedStyles","html","filter","_curry2","exports","filterSync","filterEscape","filterEscapeSync"],"sources":["html.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\nimport {curry} from 'lodash';\r\n\r\nexport {escape, escapeSync} from './html-base';\r\n\r\n/**\r\n * @param {Object} allowedTags\r\n * @param {Array<string>} allowedStyles\r\n * @param {string} html\r\n * @private\r\n * @returns {string}\r\n */\r\nfunction noop(...args) {\r\n return new Promise((resolve) => {\r\n resolve(noopSync(...args));\r\n });\r\n}\r\n\r\n/**\r\n * @param {function} processCallback callback function to do additional\r\n * processing on node. of the form process(node)\r\n * @param {Object} allowedTags\r\n * @param {Array<string>} allowedStyles\r\n * @param {string} html\r\n * @private\r\n * @returns {string}\r\n */\r\nfunction noopSync(processCallback, allowedTags, allowedStyles, html) {\r\n return html;\r\n}\r\n\r\nexport const filter = curry(noop, 4);\r\nexport const filterSync = curry(noopSync, 4);\r\nexport const filterEscape = curry(noop, 4);\r\nexport const filterEscapeSync = curry(noopSync, 4);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAAA,EAAU;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAANC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EACnB,OAAO,IAAAC,QAAA,CAAAC,OAAA,CAAY,UAACC,OAAO,EAAK;IAC9BA,OAAO,CAACC,QAAQ,CAAAC,KAAA,SAAIP,IAAI,CAAC,CAAC;EAC5B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASM,QAAQA,CAACE,eAAe,EAAEC,WAAW,EAAEC,aAAa,EAAEC,IAAI,EAAE;EACnE,OAAOA,IAAI;AACb;AAEO,IAAMC,MAAM,GAAG,IAAAC,OAAA,CAAAT,OAAA,EAAMR,IAAI,EAAE,CAAC,CAAC;AAACkB,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAC9B,IAAMG,UAAU,GAAG,IAAAF,OAAA,CAAAT,OAAA,EAAME,QAAQ,EAAE,CAAC,CAAC;AAACQ,OAAA,CAAAC,UAAA,GAAAA,UAAA;AACtC,IAAMC,YAAY,GAAG,IAAAH,OAAA,CAAAT,OAAA,EAAMR,IAAI,EAAE,CAAC,CAAC;AAACkB,OAAA,CAAAE,YAAA,GAAAA,YAAA;AACpC,IAAMC,gBAAgB,GAAG,IAAAJ,OAAA,CAAAT,OAAA,EAAME,QAAQ,EAAE,CAAC,CAAC;AAACQ,OAAA,CAAAG,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_htmlBase","require","noop","_len","arguments","length","args","Array","_key","_promise","default","resolve","noopSync","apply","processCallback","allowedTags","allowedStyles","html","filter","_curry2","exports","filterSync","filterEscape","filterEscapeSync"],"sources":["html.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {curry} from 'lodash';\n\nexport {escape, escapeSync} from './html-base';\n\n/**\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction noop(...args) {\n return new Promise((resolve) => {\n resolve(noopSync(...args));\n });\n}\n\n/**\n * @param {function} processCallback callback function to do additional\n * processing on node. of the form process(node)\n * @param {Object} allowedTags\n * @param {Array<string>} allowedStyles\n * @param {string} html\n * @private\n * @returns {string}\n */\nfunction noopSync(processCallback, allowedTags, allowedStyles, html) {\n return html;\n}\n\nexport const filter = curry(noop, 4);\nexport const filterSync = curry(noopSync, 4);\nexport const filterEscape = curry(noop, 4);\nexport const filterEscapeSync = curry(noopSync, 4);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAAA,EAAU;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAANC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EACnB,OAAO,IAAAC,QAAA,CAAAC,OAAA,CAAY,UAACC,OAAO,EAAK;IAC9BA,OAAO,CAACC,QAAQ,CAAAC,KAAA,SAAIP,IAAI,CAAC,CAAC;EAC5B,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASM,QAAQA,CAACE,eAAe,EAAEC,WAAW,EAAEC,aAAa,EAAEC,IAAI,EAAE;EACnE,OAAOA,IAAI;AACb;AAEO,IAAMC,MAAM,GAAG,IAAAC,OAAA,CAAAT,OAAA,EAAMR,IAAI,EAAE,CAAC,CAAC;AAACkB,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAC9B,IAAMG,UAAU,GAAG,IAAAF,OAAA,CAAAT,OAAA,EAAME,QAAQ,EAAE,CAAC,CAAC;AAACQ,OAAA,CAAAC,UAAA,GAAAA,UAAA;AACtC,IAAMC,YAAY,GAAG,IAAAH,OAAA,CAAAT,OAAA,EAAMR,IAAI,EAAE,CAAC,CAAC;AAACkB,OAAA,CAAAE,YAAA,GAAAA,YAAA;AACpC,IAAMC,gBAAgB,GAAG,IAAAJ,OAAA,CAAAT,OAAA,EAAME,QAAQ,EAAE,CAAC,CAAC;AAACQ,OAAA,CAAAG,gBAAA,GAAAA,gBAAA"}
package/dist/html.shim.js CHANGED
@@ -25,13 +25,13 @@ var _includes2 = _interopRequireDefault(require("lodash/includes"));
25
25
  var _forEach2 = _interopRequireDefault(require("lodash/forEach"));
26
26
  var _curry2 = _interopRequireDefault(require("lodash/curry"));
27
27
  var _htmlBase = require("./html-base");
28
- /**
29
- * Some browsers don't implement {@link Element#remove()} or
30
- * {@link NodeList#remove()} or {@link HTMLCollection#remove()}. This wrapper
31
- * calls the appropriate `#remove()` method if available, or falls back to a
32
- * non-global-polluting polyfill.
33
- * @param {Element|NodeList|HTMLCollection} node
34
- * @returns {undefined}
28
+ /**
29
+ * Some browsers don't implement {@link Element#remove()} or
30
+ * {@link NodeList#remove()} or {@link HTMLCollection#remove()}. This wrapper
31
+ * calls the appropriate `#remove()` method if available, or falls back to a
32
+ * non-global-polluting polyfill.
33
+ * @param {Element|NodeList|HTMLCollection} node
34
+ * @returns {undefined}
35
35
  */
36
36
  function removeNode(node) {
37
37
  if (node.remove) {
@@ -51,12 +51,12 @@ function removeNode(node) {
51
51
  throw new Error('Could not find a way to remove node');
52
52
  }
53
53
 
54
- /**
55
- * @param {Object} allowedTags
56
- * @param {Array<string>} allowedStyles
57
- * @param {string} html
58
- * @private
59
- * @returns {string}
54
+ /**
55
+ * @param {Object} allowedTags
56
+ * @param {Array<string>} allowedStyles
57
+ * @param {string} html
58
+ * @private
59
+ * @returns {string}
60
60
  */
61
61
  function _filter() {
62
62
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -67,23 +67,23 @@ function _filter() {
67
67
  });
68
68
  }
69
69
 
70
- /**
71
- * Curried async HTML filter.
72
- * @param {Object} allowedTags Map of tagName -> array of allowed attributes
73
- * @param {Array<string>} allowedStyles Array of allowed styles
74
- * @param {string} html html to filter
75
- * @returns {string}
70
+ /**
71
+ * Curried async HTML filter.
72
+ * @param {Object} allowedTags Map of tagName -> array of allowed attributes
73
+ * @param {Array<string>} allowedStyles Array of allowed styles
74
+ * @param {string} html html to filter
75
+ * @returns {string}
76
76
  */
77
77
  var filter = (0, _curry2.default)(_filter, 4);
78
78
 
79
- /**
80
- * @param {function} processCallback callback function to do additional
81
- * processing on node. of the form process(node)
82
- * @param {Object} allowedTags
83
- * @param {Array<string>} allowedStyles
84
- * @param {string} html
85
- * @private
86
- * @returns {string}
79
+ /**
80
+ * @param {function} processCallback callback function to do additional
81
+ * processing on node. of the form process(node)
82
+ * @param {Object} allowedTags
83
+ * @param {Array<string>} allowedStyles
84
+ * @param {string} html
85
+ * @private
86
+ * @returns {string}
87
87
  */
88
88
  exports.filter = filter;
89
89
  function _filterSync(processCallback, allowedTags, allowedStyles, html) {
@@ -101,10 +101,10 @@ function _filterSync(processCallback, allowedTags, allowedStyles, html) {
101
101
  }
102
102
  return doc.body.innerHTML;
103
103
 
104
- /**
105
- * @param {Node} node
106
- * @private
107
- * @returns {undefined}
104
+ /**
105
+ * @param {Node} node
106
+ * @private
107
+ * @returns {undefined}
108
108
  */
109
109
  function filterNode(node) {
110
110
  if (!isElement(node)) {
@@ -146,13 +146,13 @@ function _filterSync(processCallback, allowedTags, allowedStyles, html) {
146
146
  }
147
147
  }
148
148
 
149
- /**
150
- * Same as _filter, but escapes rather than removes disallowed values
151
- * @param {Function} processCallback
152
- * @param {Object} allowedTags
153
- * @param {Array<string>} allowedStyles
154
- * @param {string} html
155
- * @returns {Promise<string>}
149
+ /**
150
+ * Same as _filter, but escapes rather than removes disallowed values
151
+ * @param {Function} processCallback
152
+ * @param {Object} allowedTags
153
+ * @param {Array<string>} allowedStyles
154
+ * @param {string} html
155
+ * @returns {Promise<string>}
156
156
  */
157
157
  function _filterEscape() {
158
158
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -163,13 +163,13 @@ function _filterEscape() {
163
163
  });
164
164
  }
165
165
 
166
- /**
167
- * Same as _filterSync, but escapes rather than removes disallowed values
168
- * @param {Function} processCallback
169
- * @param {Object} allowedTags
170
- * @param {Array<string>} allowedStyles
171
- * @param {string} html
172
- * @returns {string}
166
+ /**
167
+ * Same as _filterSync, but escapes rather than removes disallowed values
168
+ * @param {Function} processCallback
169
+ * @param {Object} allowedTags
170
+ * @param {Array<string>} allowedStyles
171
+ * @param {string} html
172
+ * @returns {string}
173
173
  */
174
174
  function _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {
175
175
  if (!html || !allowedStyles || !allowedTags) {
@@ -186,10 +186,10 @@ function _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {
186
186
  }
187
187
  return doc.body.innerHTML;
188
188
 
189
- /**
190
- * @param {Node} node
191
- * @private
192
- * @returns {undefined}
189
+ /**
190
+ * @param {Node} node
191
+ * @private
192
+ * @returns {undefined}
193
193
  */
194
194
  function filterNode(node) {
195
195
  if (!isElement(node)) {
@@ -231,10 +231,10 @@ function _filterEscapeSync(processCallback, allowedTags, allowedStyles, html) {
231
231
  }
232
232
  }
233
233
 
234
- /**
235
- * Escapes a given html node
236
- * @param {Node} node
237
- * @returns {undefined}
234
+ /**
235
+ * Escapes a given html node
236
+ * @param {Node} node
237
+ * @returns {undefined}
238
238
  */
239
239
  function escapeNode(node) {
240
240
  var before = document.createTextNode("<".concat(node.nodeName.toLowerCase(), ">"));
@@ -248,18 +248,18 @@ function escapeNode(node) {
248
248
  }
249
249
  var trimPattern = /^\s|\s$/g;
250
250
 
251
- /**
252
- * @param {string} str
253
- * @returns {string}
251
+ /**
252
+ * @param {string} str
253
+ * @returns {string}
254
254
  */
255
255
  function trim(str) {
256
256
  return str.replace(trimPattern, '');
257
257
  }
258
258
 
259
- /**
260
- * @param {Node} node
261
- * @private
262
- * @returns {undefined}
259
+ /**
260
+ * @param {Node} node
261
+ * @private
262
+ * @returns {undefined}
263
263
  */
264
264
  function reparent(node) {
265
265
  while (node.childNodes.length > 0) {
@@ -268,10 +268,10 @@ function reparent(node) {
268
268
  removeNode(node);
269
269
  }
270
270
 
271
- /**
272
- * @param {NamedNodeMap} attributes
273
- * @private
274
- * @returns {Array<string>}
271
+ /**
272
+ * @param {NamedNodeMap} attributes
273
+ * @private
274
+ * @returns {Array<string>}
275
275
  */
276
276
  function listAttributeNames(attributes) {
277
277
  return (0, _reduce2.default)(attributes, function (attrNames, attr) {
@@ -280,11 +280,11 @@ function listAttributeNames(attributes) {
280
280
  }, []);
281
281
  }
282
282
 
283
- /**
284
- * @param {Array} list
285
- * @param {Function} fn
286
- * @private
287
- * @returns {undefined}
283
+ /**
284
+ * @param {Array} list
285
+ * @param {Function} fn
286
+ * @private
287
+ * @returns {undefined}
288
288
  */
289
289
  function depthFirstForEach(list, fn) {
290
290
  for (var i = list.length; i >= 0; i -= 1) {
@@ -292,10 +292,10 @@ function depthFirstForEach(list, fn) {
292
292
  }
293
293
  }
294
294
 
295
- /**
296
- * @param {Node} o
297
- * @private
298
- * @returns {Boolean}
295
+ /**
296
+ * @param {Node} o
297
+ * @private
298
+ * @returns {Boolean}
299
299
  */
300
300
  function isElement(o) {
301
301
  if (!o) {
@@ -313,31 +313,31 @@ function isElement(o) {
313
313
  return true;
314
314
  }
315
315
 
316
- /**
317
- * Curried HTML filter.
318
- * @param {Object} allowedTags Map of tagName -> array of allowed attributes
319
- * @param {Array<string>} allowedStyles Array of allowed styles
320
- * @param {string} html html to filter
321
- * @returns {string}
316
+ /**
317
+ * Curried HTML filter.
318
+ * @param {Object} allowedTags Map of tagName -> array of allowed attributes
319
+ * @param {Array<string>} allowedStyles Array of allowed styles
320
+ * @param {string} html html to filter
321
+ * @returns {string}
322
322
  */
323
323
  var filterSync = (0, _curry2.default)(_filterSync, 4);
324
324
 
325
- /**
326
- * Curried HTML filter that escapes rather than removes disallowed tags
327
- * @param {Object} allowedTags Map of tagName -> array of allowed attributes
328
- * @param {Array<string>} allowedStyles Array of allowed styles
329
- * @param {string} html html to filter
330
- * @returns {Promise<string>}
325
+ /**
326
+ * Curried HTML filter that escapes rather than removes disallowed tags
327
+ * @param {Object} allowedTags Map of tagName -> array of allowed attributes
328
+ * @param {Array<string>} allowedStyles Array of allowed styles
329
+ * @param {string} html html to filter
330
+ * @returns {Promise<string>}
331
331
  */
332
332
  exports.filterSync = filterSync;
333
333
  var filterEscape = (0, _curry2.default)(_filterEscape, 4);
334
334
 
335
- /**
336
- * Curried HTML filter that escapes rather than removes disallowed tags
337
- * @param {Object} allowedTags Map of tagName -> array of allowed attributes
338
- * @param {Array<string>} allowedStyles Array of allowed styles
339
- * @param {string} html html to filter
340
- * @returns {string}
335
+ /**
336
+ * Curried HTML filter that escapes rather than removes disallowed tags
337
+ * @param {Object} allowedTags Map of tagName -> array of allowed attributes
338
+ * @param {Array<string>} allowedStyles Array of allowed styles
339
+ * @param {string} html html to filter
340
+ * @returns {string}
341
341
  */
342
342
  exports.filterEscape = filterEscape;
343
343
  var filterEscapeSync = (0, _curry2.default)(_filterEscapeSync, 4);