validator.js
validator.js copied to clipboard
feat(isUpiId): Added regex and tests for UPI id validation
Added validation for a given UPI id so that people can validate the UPI addresses before performing any transaction as per issue #2317 .
Read more about UPI(Unified Payments Interface): https://en.wikipedia.org/wiki/Unified_Payments_Interface
Checklist
- [x] PR contains only changes related; no stray files, etc.
- [x] README updated (where applicable)
- [x] Tests written (where applicable)
- [x] References provided in PR (where applicable)
Codecov Report
All modified lines are covered by tests :white_check_mark:
Comparison is base (
b958bd7) 99.95% compared to head (3942950) 98.57%.
Additional details and impacted files
@@ Coverage Diff @@
## master #2318 +/- ##
==========================================
- Coverage 99.95% 98.57% -1.39%
==========================================
Files 107 108 +1
Lines 2454 2457 +3
Branches 619 620 +1
==========================================
- Hits 2453 2422 -31
- Misses 0 35 +35
+ Partials 1 0 -1
| Files | Coverage Δ | |
|---|---|---|
| src/index.js | 100.00% <100.00%> (ø) |
|
| src/lib/isUpiId.js | 100.00% <100.00%> (ø) |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Haven't thought about the usefulness of this validator yet, but do have an initial comment
Users can use this in those scenarios where they are storing some UPI id in their database which is quite crucial and a well defined format or a check should be there so that they cannot fill any type of data they wish to store rather a proper formatted data would be stored in database. Also in certain scenarios it might catch the typos made by the users.