lib: use validateArray for array arguments - #65344
Open
DevJunz wants to merge 1 commit into
Open
Conversation
Three call sites still duplicated the ArrayIsArray check that validateArray already performs. Both files were already importing other validators next to these checks. The error code, argument name and expected type are unchanged, so the thrown error stays identical. The ArrayIsArray primordial is no longer used in histogram.js and is dropped from its destructuring; blocklist.js still uses it elsewhere. The existing tests only asserted the error code, so assertions covering the full error message are added for all three call sites. They pass both before and after this change. Refs: nodejs#64959 Assisted-by: claude:fable-5 Signed-off-by: JunHwan Choi <devjunsday@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65344 +/- ##
=======================================
Coverage 90.13% 90.13%
=======================================
Files 752 752
Lines 251569 251604 +35
Branches 47264 47272 +8
=======================================
+ Hits 226745 226790 +45
+ Misses 16181 16164 -17
- Partials 8643 8650 +7
🚀 New features to boost your workflow:
|
jasnell
approved these changes
Aug 17, 2026
Collaborator
atlowChemi
approved these changes
Aug 17, 2026
lpinca
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #64959: replace the three remaining
ArrayIsArraychecks inhistogram.jsandblocklist.jswithvalidateArray(). The thrown erroris identical —
validateArraythrows the sameERR_INVALID_ARG_TYPE(name, 'Array', value), and itsminLengthbranchcannot trigger at the default of
0.The existing tests only asserted the error
code, so this also addsassertions on the exact error messages at all three call sites. They pass
both before and after the change.
Other similar sites in
lib/throw different expected-type strings andare intentionally left alone.
Refs: #64959