Skip to content

jill64/universal-sanitizer

Repository files navigation

@jill64/universal-sanitizer

npm-version npm-license npm-download-month npm-min-size ci.yml

💎 Isomorphic html sanitizer by DOMPurify + sanitize-html

Installation

npm i @jill64/universal-sanitizer

Usage

Conditional Export applies the appropriate file at each runtime.

import { sanitize } from '@jill64/universal-sanitizer'

const cleaned = sanitize(/* ... */, {
  // options: {
  //   sanitizeHtml: sanitize-html options
  //   dompurify: DOMPurify options
  // }
})
condition resolve
browser DOMPurify
default sanitize-html
worker sanitize-html

License

MIT