Skip to content

fix: treat ignored s as a literal character - #2938

Open
Plastic-time wants to merge 1 commit into
validatorjs:masterfrom
Plastic-time:fix/literal-ignore-s-20261020
Open

Plastic-time wants to merge 1 commit into
validatorjs:masterfrom
Plastic-time:fix/literal-ignore-s-20261020

Conversation

@Plastic-time

Copy link
Copy Markdown

isAlpha and isAlphanumeric currently turn the literal string option ignore: 's' into the regexp whitespace class. For example, isAlpha('ab cd', 'en-US', {ignore: 's'}) incorrectly returns true, while a literal s embedded in a Russian string is not removed.

Remove the stray s from both regexp-escaping character classes. String ignore options now remove the requested literal character; explicit whitespace, regexp metacharacters, and RegExp-valued options retain their behavior. This restores the existing README contract and introduces no API or locale-table change.

Validation on Node 24.20.0 / Windows:

  • Built unchanged source and ran the new Mocha regression file: four intended failures and four compatibility passes.
  • npm test after the fix: Node/ES/browser/minified builds, ESLint, and all 331 tests pass.
  • Independent agent review exercised 33,848 additional character-option checks across Node, UMD, minified UMD and ESM generated forms. The browser bundles were evaluated in Node; this is not a claim of a full browser CI run.

Duplicate check: open #2086 and #2087 refactor option signatures but retain the original escaping expression; their actual diffs do not fix this case. Latest master was checked before submission.

AI assisted the implementation and this description; a separate agent reviewed the final diff and tried counterexamples. No human review is claimed.

Checklist

  • PR contains only related source changes and regression tests; no generated files.
  • README reviewed; its existing literal-ignore contract is unchanged.
  • Tests written and verified to fail before the fix.
  • References provided where applicable: existing README API contract and related PR comparison above; no format-data update.

@codecov

codecov Bot commented Oct 20, 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 (aa51526).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2938   +/-   ##
=========================================
  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.

@Plastic-time
Plastic-time marked this pull request as ready for review October 22, 2026 01:29
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