1.0.21 • Published 9 months ago

universal-dompurify v1.0.21

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

universal-dompurify

šŸ’Ž Use DOMPurify for some context by conditional exports

Installation

npm i universal-dompurify

Usage

Conditional exports apply the appropriate DOMPurify file at each run.

import DOMPurify from 'universal-dompurify'

const cleaned = DOMPurify.sanitize(/* ... */)
conditionresolve
browserDOMPurify
defaultDOMPurify + JSDOM
workerDOMPurify + JSDOM + (require: your external node polyfills)

!TIP It is generally not recommended to use JSDOM with the restricted Edge runtime.
See also @jill64/universal-sanitizer for a more lightweight alternative.

Browser Only Mode

Reduces bundle size by omitting rendering on the server.

/** @type {DOMPurify | null} */
import DOMPurify from 'universal-dompurify/browser-only'

const cleaned = DOMPurify?.sanitize?.(/* ... */) ?? 'server-fallback-value'
conditionresolve
browserDOMPurify
defaultnull
workernull

License

MIT

1.0.21

9 months ago

1.0.20

9 months ago

1.0.19

10 months ago

1.0.18

10 months ago

1.0.17

10 months ago

1.0.16

11 months ago

1.0.15

12 months ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago