Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(isBtcAddress): get rid of unnecessary if statement and comment #2132

Merged

Conversation

pano9000
Copy link
Contributor

  • there is no need to do a check before, which RegExp use, just test for both and return accordingly, if either one matches
  • refactored version also is bit faster as well, according to Benchmark.js tests I did
  • also removed one unnecessary comment line, it does not really add any information at all

Checklist

  • PR contains only changes related; no stray files, etc.
  • [ ] README updated (where applicable)
  • [ ] Tests written (where applicable)

* there is no need to do a check before, which RegExp use
* refactored version also is bit faster as well, according to Benchmark.js tests I did
@codecov
Copy link

codecov bot commented Dec 19, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (c6d41d0) compared to base (531dc7f).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2132   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          104       104           
  Lines         2308      2306    -2     
  Branches       578       578           
=========================================
- Hits          2308      2306    -2     
Impacted Files Coverage Δ
src/lib/isBtcAddress.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@rubiin rubiin added ready-to-land For PRs that are reviewed and ready to be landed ✅ LGTM labels Jan 21, 2023
Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@profnandaa profnandaa merged commit dcb6cb6 into validatorjs:master Jan 22, 2023
@pano9000 pano9000 deleted the refactor_simplify-isBtcAddress_v2 branch January 22, 2023 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ LGTM ready-to-land For PRs that are reviewed and ready to be landed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants