Repository navigation
fix: use format for map argument validation errors in array/bool and array/float16 - #16243
Draft
Planeshifter wants to merge 2 commits into
Draft
Planeshifter wants to merge 2 commits into
Planeshifter wants to merge 2 commits into
Conversation
The `map` method passed a `%s` template string and the offending value directly to the `TypeError` constructor, which resulted in an error message containing a literal `%s` placeholder. This commit wraps the message in `format`, in line with every other value-interpolating error message in the package (14 of 14 sibling throws) and the majority of `@stdlib/array` packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfJGbrwW1ETRRzyKehDvvX
The `map` method of the `Float16Array` polyfill passed a `%s` template string and the offending value directly to the `TypeError` constructor, which resulted in an error message containing a literal `%s` placeholder. This commit wraps the message in `format`, in line with every other value-interpolating error message in the polyfill (12 of 12 sibling throws) and the majority of `@stdlib/array` packages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfJGbrwW1ETRRzyKehDvvX
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
This branch has not been deployed
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.
Description
This pull request:
mapmethod's invalid-callbackTypeErrormessage informatin@stdlib/array/booland@stdlib/array/float16, so that error messages interpolate the offending value instead of showing a literal%s.@stdlib/array/boolBooleanArray.prototype.mappassed the%stemplate andfcndirectly toTypeError, so the message contained a literal%sand the value was dropped. Every other value-interpolating throw inlib/main.js(14/14) usesformat, which the file already imports.@stdlib/array/float16The
Float16Arraypolyfill'smapmethod had the same defect inlib/polyfill/index.js. All 12 sibling throws in the file useformat, which the file already imports.Related Issues
No.
Questions
No.
Other
Namespace summary. The
@stdlib/arraynamespace has 107 members. Analyzed features: file tree,package.jsonkeys, README sections, error construction, and JSDoc shape (@example,@returns,@module). Features with a clear majority (≥75%) were file tree,package.jsonkeys, READMEUsage/Examplessections, and JSDoc tags. Features without one were excluded, including error construction across packages (format61% among packages that throw). Within each affected file, however,formatis used in 100% of value-interpolating throws.Validation. Structural features were extracted by script and semantic features by static parsing of
lib/*.js. Each candidate was then reviewed for semantic intent and cross-referenced against tests and docs. The existingtest.map.jssuites only assert the error type and pass unchanged:array/bool34/34,array/float1633/33, and thearray/float16polyfill 34/34. The following were deliberately excluded:repl.txt,*.d.ts,## See Also);complex128,slice,float32,float64,uint64,fixed-endian-*);lib/main.jsre-exports a global and so lacks@example.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code as part of an automated cross-package API drift detection run.
@stdlib-js/reviewers
Generated by Claude Code