Added support for zh-HK in isIdentityCard by songyuew · Pull Request #2142 · validatorjs/validator.js
Apologies for not noticing this point. Actually, I share the same thought with you: this validator should only take care about the validation part. However, I noticed other contributors in isIdentityCard.js all wrote codes to sanitize the incoming string:
const sanitized = str.trim().toUpperCase();
const sanitized = str.trim();
To make my codes consistent with others, I believe it is better to keep the sanitization before validation.