-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1631 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 100 101 +1
Lines 1843 1859 +16
=========================================
+ Hits 1843 1859 +16
Continue to review full report at Codecov.
|
There was a problem hiding this 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') { |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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
BTW, is XRP a standard or proprietary? |
what is the latest status here? |
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