isomorphic-dompurify 1.13.0 → 2.0.0
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/README.md +8 -13
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,23 +39,18 @@ Please note that DOMPurify library [doesn't follow Semantic Versioning](https://
|
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
Import:
|
|
44
43
|
```javascript
|
|
45
|
-
|
|
46
|
-
import { sanitize, isSupported } from "isomorphic-dompurify";
|
|
47
|
-
|
|
48
|
-
// or the entire module:
|
|
49
|
-
import DOMPurify from 'isomorphic-dompurify';
|
|
50
|
-
|
|
51
|
-
// or as a CommonJS module:
|
|
52
|
-
const DOMPurify = require('isomorphic-dompurify');
|
|
44
|
+
import { sanitize } from "isomorphic-dompurify";
|
|
53
45
|
```
|
|
54
46
|
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
Sanitize:
|
|
48
|
+
```javascript
|
|
49
|
+
const clean = sanitize(dirtyString);
|
|
50
|
+
```
|
|
51
|
+
or with [config](https://github.com/cure53/DOMPurify/blob/main/README.md):
|
|
57
52
|
```javascript
|
|
58
|
-
const clean =
|
|
53
|
+
const clean = sanitize(dirtyString, { USE_PROFILES: { html: true } });
|
|
59
54
|
```
|
|
60
55
|
|
|
61
56
|
## Known Issues
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e&&e.default||e}module.exports=global.DOMPurify=global.DOMPurify||("undefined"
|
|
1
|
+
function e(e){return e&&e.default||e}module.exports=global.DOMPurify=global.DOMPurify||("undefined"!=typeof window?e(require("dompurify")):function(){const r=e(require("dompurify")),{JSDOM:u}=e(require("jsdom")),{window:o}=new u("<!DOCTYPE html>");return r(o)}());
|