perf(isISO31661Alpha2): use a Set along with .has instead of includes by jmpaya · Pull Request #1724 · validatorjs/validator.js

Conversation

@jmpaya

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)
fix(isBIC): refactor use of CountryCodes using Set's methods

@codecov

tux-tn

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 🎉

profnandaa

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!

Labels