How can I add, import, and utilize DOMPurify in a frontend JavaScript file?

Is it secure to use DOMPurify via npm and ES module import in a browser file? For example:

npm install safeDOM-lib --save
import safeCleaner from 'safeDOM-lib';
console.log(safeCleaner.clean('<div onclick="doAlert()">test</div>', { enableJquery: true }));

hey, i used it and found its pretty secure if u keep on top of updates. not entirely sure abt the jquery option tho, anyone els experimenting with it or encountered issues? curious to hear ur thoughts.

i’ve worked with dompurify and found it solid if u keep it updated. some quirks with jquery though, so always run a few tests for your setup. device may vary btw, so stay in tune with patch notes.