diff options
author | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-02-08 16:41:06 +0100 |
---|---|---|
committer | Anton Luka Šijanec <sijanecantonluka@gmail.com> | 2020-02-08 16:41:06 +0100 |
commit | f87697e22f289cc96fc4e79da81575115b3e89a2 (patch) | |
tree | 57870d84a853db60c80e254beb423c838d910fbe /node_modules/xss/lib/index.js | |
parent | changed version to 1.0.7-beta (diff) | |
download | beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.tar beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.tar.gz beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.tar.bz2 beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.tar.lz beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.tar.xz beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.tar.zst beziapp-f87697e22f289cc96fc4e79da81575115b3e89a2.zip |
Diffstat (limited to 'node_modules/xss/lib/index.js')
-rw-r--r-- | node_modules/xss/lib/index.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/node_modules/xss/lib/index.js b/node_modules/xss/lib/index.js new file mode 100644 index 0000000..e0c1a06 --- /dev/null +++ b/node_modules/xss/lib/index.js @@ -0,0 +1,40 @@ +/** + * xss + * + * @author Zongmin Lei<leizongmin@gmail.com> + */ + +var DEFAULT = require("./default"); +var parser = require("./parser"); +var FilterXSS = require("./xss"); + +/** + * filter xss function + * + * @param {String} html + * @param {Object} options { whiteList, onTag, onTagAttr, onIgnoreTag, onIgnoreTagAttr, safeAttrValue, escapeHtml } + * @return {String} + */ +function filterXSS(html, options) { + var xss = new FilterXSS(options); + return xss.process(html); +} + +exports = module.exports = filterXSS; +exports.filterXSS = filterXSS; +exports.FilterXSS = FilterXSS; +for (var i in DEFAULT) exports[i] = DEFAULT[i]; +for (var i in parser) exports[i] = parser[i]; + +// using `xss` on the browser, output `filterXSS` to the globals +if (typeof window !== "undefined") { + window.filterXSS = module.exports; +} + +// using `xss` on the WebWorker, output `filterXSS` to the globals +function isWorkerEnv() { + return typeof self !== 'undefined' && typeof DedicatedWorkerGlobalScope !== 'undefined' && self instanceof DedicatedWorkerGlobalScope; +} +if (isWorkerEnv()) { + self.filterXSS = module.exports; +} |