-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Just making an issue now so we don't forget about it, but we'll discuss this in the future. In #2144 (comment) and #2157 (comment) it came up how the validators should handle sanitization (if at all). We should try to unify it through the various validators so it is clear to the user what their role is. This might also be considered a breaking change so I don't think we need to change this anytime soon (and even so we can start with an opt-in possibly)
Examples of current sanitization include;
validator.js/src/lib/isIdentityCard.js
Line 116 in 753c29d
const sanitized = str.trim(); |
validator.js/src/lib/isCreditCard.js
Line 20 in 753c29d
const sanitized = card.replace(/[- ]+/g, ''); |
validator.js/src/lib/isISBN.js
Line 13 in 753c29d
const sanitized = str.replace(/[\s-]+/g, ''); |