Skip to content

feat(isDecimal, isFloat, isNumeric): add ne-NP locale - #2969

Open
pabin wants to merge 1 commit into
validatorjs:masterfrom
pabin:feat/ne-np-decimal
Open

pabin wants to merge 1 commit into
validatorjs:masterfrom
pabin:feat/ne-np-decimal

Conversation

@pabin

@pabin pabin commented Nov 22, 2026

Copy link
Copy Markdown

Adds Nepali (ne-NP) to isDecimal, isFloat and isNumeric. Nepali uses . as the decimal separator, but the locale is missing from the decimal separator table:

// before
isDecimal('1.5', { locale: 'ne-NP' }); // throws Invalid locale 'ne-NP'
isFloat('1.5', { locale: 'ne-NP' });   // false
isNumeric('1.5', { locale: 'ne-NP' }); // false

// after: all three return true, and '1,5' is rejected

The fix adds ne-NP to dotDecimal in src/lib/alpha.js. As with the other locales in these validators, only ASCII digits are accepted, so १.५ is not.

References:

Validation:

  • The new tests fail on master and pass with this change
  • npm test on Node 26: 325 passing, build and ESLint included

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 Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2969   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2599      2599           
  Branches       658       658           
=========================================
  Hits          2599      2599           

☔ 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.

2 participants