perf(isISO31661Alpha2): use a Set along with .has instead of includes by jmpaya · Pull Request #1724 · validatorjs/validator.js
Conversation
perf(isISO31661Alpha2): use a Set along with .has instead of includes
fix(isBIC): refactor use of CountryCodes using Set's methods
Updated isISO31661Alpha2 to use a Set along with .has to reduce complexity from O(n) to O(1) as stated here.
Updated isBIC to use Set's methods instead of Array's.
Checklist
- PR contains only changes related; no stray files, etc.
- README updated (where applicable)
- Tests written (where applicable)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, nice catch!
LGTM 🎉
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM too, thanks for your contrib!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters