validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

feat(isUpiId): Added regex and tests for UPI id validation

Open Swarga-codes opened this issue 2 years ago • 2 comments

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)

Swarga-codes avatar Oct 07 '23 17:10 Swarga-codes

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%> (ø)

... and 3 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 07 '23 21:10 codecov[bot]

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.

Swarga-codes avatar Oct 07 '23 21:10 Swarga-codes