-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add onSanitize
and dryRun
option
#39
Conversation
} | ||
|
||
function sanitize(target, options) { | ||
return _sanitize(target, options).target; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This _sanitize
aims to preserve backward compatibility…
* @param {{replaceWith?: string, onSanitize?: function, dryRun?: boolean}} options | ||
* @returns {function} | ||
*/ | ||
function middleware(options = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use default parameter instead of options = options || {};
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters
@@ -5,6 +5,17 @@ const express = require('express'); | |||
const bodyParser = require('body-parser'); | |||
const expect = require('chai').expect; | |||
const sanitize = require('./index.js'); | |||
const callTracker = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node.js 12+ has https://nodejs.org/api/assert.html#assert_class_assert_calltracker
But Node.js 10 does not this.
@fiznool Can you review it? |
@azu sorry for the delay, I've been off sick the past few days. I will try to take a look this week, thank you for your patience! |
If you are busy, I can help you to maintain this library. |
Sorry for the delay. I've merged this in and will release a new minor version once I've updated the dependencies. Help with this module would be appreciated - I will add you to the repo? |
Thanks for inviting me! I will help to merge #41 and support TypeScript(rewritten with TS or just add |
TypeScript support would be awesome. I'd prefer to go for the separate ambient types, rewrites often make me nervous! |
OK! I've created an issue #55 |
onSanitize
optiondryRun
optionThe
onSanitize
callback will be called even if thedryRun
istrue
.It aims to remove a built-in warning like #35 (comment) from this module
fix #35