You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Providing a function for the replaceWith option only works if the function (when converted to a string) does not contain a "." character. This is due to the regex test here:
By doing this, users can be more specific with their replace value, e.g.:
mongoSanitize({replaceWith: (match)=>{switch(match){case'$':
return'_dollar_';case'.': // this line currently triggers the `TEST_REGEX.test(options.replaceWith)`return'_dot_';default:
return'_';}}})
The text was updated successfully, but these errors were encountered:
Providing a function for the
replaceWith
option only works if the function (when converted to a string) does not contain a"."
character. This is due to the regex test here:Recommend allowing any function for
replaceWith
by changing that block to:By doing this, users can be more specific with their replace value, e.g.:
The text was updated successfully, but these errors were encountered: