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

feat(isXRPAddress): add validator #1631

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tadejgolobic
Copy link

Issue: #1630

Added new validator that will check if string is valid XRP address.
Added test to check this new validator
Update readme and add documentation regarding this new validator

Checklist

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

@codecov
Copy link

codecov bot commented Mar 18, 2021

Codecov Report

Merging #1631 (408f7ba) into master (63b6162) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1631   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          100       101    +1     
  Lines         1843      1859   +16     
=========================================
+ Hits          1843      1859   +16     
Impacted Files Coverage Δ
src/index.js 100.00% <100.00%> (ø)
src/lib/isXRPAddress.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 63b6162...408f7ba. Read the comment docs.

Copy link
Member

@ezkemboi ezkemboi left a comment

Choose a reason for hiding this comment

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

I will continue to make more testing here

export default function isXRPAddress(address, options) {
assertString(address);

if (typeof (options) !== 'object') {
Copy link
Member

Choose a reason for hiding this comment

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

I can say, even typeof (null) === object.
One of the best ways to check object type is to check its prototype ie.
Object.prototype.toString.call(option).toLowerCase(), most of the case is that the second part after space is the type.
I think I will add a validator to check the type

return classicAddressRegex.test(address);
}

if (typeof (options.xAddress) !== 'object') {
Copy link
Member

Choose a reason for hiding this comment

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

I have written that help us make a robust code here, #1648

@profnandaa
Copy link
Member

BTW, is XRP a standard or proprietary?

@pano9000
Copy link
Contributor

pano9000 commented Sep 5, 2024

what is the latest status here?
is there anything still missing here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants