Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run(body, settings = Preset.Strict) {
if (settings.allowedAttributes instanceof Array) {
const attrMap = {};
for (const tag of settings.allowedTags) {
attrMap[tag] = settings.allowedAttributes;
}
settings.allowedAttributes = attrMap;
}
if (!sanitizeHtml) {
sanitizeHtml = require('sanitize-html').default; //eslint-disable-line
}
return Promise.resolve(sanitizeHtml(body, settings));
}
}