Skip to content

fix: ignore non-object options in isHexColor (#2660)#2661

Merged
rubiin merged 4 commits intovalidatorjs:masterfrom
yuna0831:master
Feb 28, 2026
Merged

fix: ignore non-object options in isHexColor (#2660)#2661
rubiin merged 4 commits intovalidatorjs:masterfrom
yuna0831:master

Conversation

@yuna0831
Copy link
Contributor

This PR fixes #2660. When isHexColor is used as a callback in Array.prototype.filter, the second argument (index) is passed as the options parameter. This fix ensures options is an object before calling the merge utility.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (88e0d3d) to head (2f2d987).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2661   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2590      2592    +2     
  Branches       659       660    +1     
=========================================
+ Hits          2590      2592    +2     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member

@WikiRik WikiRik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add the check to the merge util? That way we cover it for other validators as well. Also; can you add a test for this?

@yuna0831
Copy link
Contributor Author

Thanks for the suggestion @WikiRik. I've refactored the fix into the merge utility and added a test for the filter use case. All 309 tests passed without linting issues. Ready for another review!"

@WikiRik WikiRik requested a review from rubiin February 28, 2026 09:10
@rubiin rubiin merged commit f39bb3b into validatorjs:master Feb 28, 2026
9 checks passed
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.

New options object for isHexColor breaks Array.filter

3 participants