Version Bumps (#2677)

* chore: upgraded versions

* chore: linting

* fix: updated snap
This commit is contained in:
Wyatt Johnson
2019-10-28 23:45:21 +00:00
committed by GitHub
parent a7eb757be7
commit a31ee3bc96
8 changed files with 166 additions and 128 deletions
@@ -8,7 +8,8 @@ Object {
`;
exports[`allows anchor tags and counts them correctly 1`] = `
"<div>
"
<div>
<a href=\\"https://mozilla.org/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">https://mozilla.org/</a>
<a href=\\"https://mozilla.org/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">https://mozilla.org/</a>
</div>
+6 -7
View File
@@ -1,11 +1,10 @@
import newDOMPurify, { DOMPurify } from "dompurify";
import createDOMPurify from "dompurify";
export function createPurify<T extends boolean = true>(
window: Window,
returnDOM: T = true as T
) {
type DOMPurify = ReturnType<typeof createDOMPurify>;
export function createPurify(window: Window, returnDOM = true) {
// Initializing JSDOM and DOMPurify
const purify = newDOMPurify<T>(window);
const purify = createDOMPurify(window);
// Setting our DOMPurify config.
purify.setConfig({
@@ -42,7 +41,7 @@ export function createPurify<T extends boolean = true>(
export function sanitizeCommentBody(purify: DOMPurify, source: string) {
// Sanitize and return the HTMLBodyElement for the parsed source.
const sanitized = purify.sanitize(source);
const sanitized = purify.sanitize(source, { RETURN_DOM: true });
// Count the total number of anchor links in the sanitized output, this is the
// number of links.