@wpe-tkpd/xss
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -9,2 +9,5 @@ import DOMPurify from 'dompurify'; | ||
declare function sanitizeHtmlBrowser(dirtyHtml: string, options: DOMPurify.Config & { | ||
RETURN_TRUSTED_TYPE: true; | ||
}, domPurifyInstance?: DOMPurify.DOMPurifyI): Window['TrustedHTML']; | ||
declare function sanitizeHtmlBrowser(dirtyHtml: string, options: DOMPurify.Config & { | ||
RETURN_DOM_FRAGMENT?: false; | ||
@@ -11,0 +14,0 @@ RETURN_DOM?: false; |
import DOMPurify from 'dompurify'; | ||
function sanitizeHtmlBrowser(dirtyHtml, options = {}, domPurifyInstance = DOMPurify) { | ||
const { RETURN_TRUSTED_TYPE } = options; | ||
if (RETURN_TRUSTED_TYPE) { | ||
const sanitizedHtml = domPurifyInstance.sanitize(dirtyHtml, Object.assign(Object.assign({}, options), { RETURN_TRUSTED_TYPE: true })); | ||
return sanitizedHtml; | ||
} | ||
const sanitizedHtml = domPurifyInstance.sanitize(dirtyHtml, options); | ||
@@ -4,0 +9,0 @@ return sanitizedHtml; |
{ | ||
"name": "@wpe-tkpd/xss", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Various sanitizer, escaper, encoder, and utilities to prevent XSS", | ||
"sideEffects": false, | ||
"files": [ | ||
"dist", | ||
"!__tests__" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"tc": "tsc --noEmit", | ||
"lint:only": "lint-staged -c lint-staged.config.js", | ||
"lint": "pnpm run lint:only && pnpm run tc", | ||
"babel:build": "babel src -d dist --extensions '.js,.jsx,.ts,.tsx' --ignore '**/*.(test).(j|t)sx?' --verbose --source-maps", | ||
"lint:staged": "lint-staged -c lint-staged.config.js", | ||
"lint": "pnpm run lint:staged && pnpm run tc", | ||
"babel:build": "babel src -d dist --extensions '.js,.jsx,.ts,.tsx' --ignore '**/__tests__/**' --verbose --source-maps", | ||
"dev": "babel -w src -d dist --extensions '.js,.jsx,.ts,.tsx' --ignore '**/*.(test).(j|t)sx?' --verbose --source-maps", | ||
"build-package": "pnpm run babel:build && tsc --build", | ||
"build": "rm -rf dist && pnpm run build-package" | ||
"build": "rm -rf dist && pnpm run build-package", | ||
"prepare": "pnpm run tc && pnpm run test && pnpm run build" | ||
}, | ||
@@ -16,0 +21,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11851
14
48
1