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 287075b commit 05e39bb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ function middleware(options) {
req[k] = sanitize(
req[k],
options,
options?.allowDots ? TEST_REGEX_WITHOUT_DOT : TEST_REGEX
options
? options.allowDots
? TEST_REGEX_WITHOUT_DOT
: TEST_REGEX
: null
);
}
});
Expand Down

0 comments on commit 05e39bb

Please sign in to comment.