Skip to content

feat: add isUsername validator and fix empty string bug in isNumeric - #2883

Open
Rughena wants to merge 2 commits into
validatorjs:masterfrom
Rughena:master
Open

feat: add isUsername validator and fix empty string bug in isNumeric#2883
Rughena wants to merge 2 commits into
validatorjs:masterfrom
Rughena:master

Conversation

@Rughena

@Rughena Rughena commented Sep 8, 2026

Copy link
Copy Markdown

feat: add isUsername validator and fix empty string bug in isNumeric

Description
This Pull Request introduces a new string validator and resolves an edge case issue in an existing validator.

  1. New Feature (isUsername): Created a self contained string validator in src/lib/isUsername.js and registered it alphabetically inside src/index.js. It ensures a username string has a length between 3 and 15 characters and does not contain restricted special characters (@, #, $).
  2. Bug Fix (isNumeric): Added an explicit guard clause to return false if the input string is empty (str.length === 0), avoiding unintended behavior down the line.

Checklist

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

@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a79ff98) to head (308220e).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2883   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       115    +1     
  Lines         2599      2613   +14     
  Branches       658       662    +4     
=========================================
+ Hits          2599      2613   +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant