mongoose-sanitizer-plugin
Sanitizer for mongoose models.
Uses Caja-HTML-Sanitizer.
Installation
npm i mongoose-sanitizer-plugin --save
Options
Parameter | Type | Default | Description |
---|---|---|---|
mode | String |
escape |
Enum: sanitizer , escape , normalizeRCData , unescapeEntities . See Caja-HTML-Sanitizer docs. |
include | String , Array<String> |
[] |
List of properties that will be sanitized. |
exclude | String , Array<String> |
[] |
List of properties that won't be sanitized. |
If both include
and exclude
are not specified then all string properties will be sanitized.
Examples
Minimal usage:
const sanitizerPlugin = ;const mongoose = ;const SomeSchema = /* ... */ ; SomeSchema; mongoose;
Specifying your own options:
SomeSchema;
Specifying options with different mode for every group of properties:
SomeSchema;