Skip to content

Commit

Permalink
feat: Adding new options (options.allowDots)
Browse files Browse the repository at this point in the history
Adding new option/feature, options.allowDots that is used for skipping the sanitization of data that has .(dot). This can be useful for nested document quering for mongoDb: https://docs.mongodb.com/manual/tutorial/query-embedded-documents/

Creating new tests that include the new option

Updating the documentation (README.md) file for the new option

Adressing issue: #36
  • Loading branch information
Blagoj5 committed Jan 23, 2021
1 parent aec9249 commit 287075b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ function sanitize(target, options, regex) {
if (!regex) {
regex = TEST_REGEX;

if (options?.allowDots) {
TEST_REGEX = TEST_REGEX_WITHOUT_DOT;
if (options) {
if (options.allowDots) {
TEST_REGEX = TEST_REGEX_WITHOUT_DOT;
}
}
}

Expand Down

0 comments on commit 287075b

Please sign in to comment.