Anybody explain me what is the use of dompurify and jsdom module.
Completely different subject: if you have some UI where users can input raw HTML and that input gets processed into your application (examples: comment sections/forums where users can mark up their posts using HTML), that’s an attack vector. You can sanitise that input to prevent XSS attacks, dompurify is a library that does this. Give it a string of HTML markup, it will sanitise it. See the example: https://cure53.de/purify