Repository navigation
chore: clean-up - #15612
Merged
Merged
chore: clean-up#15612
Conversation
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Added missing benchmark/benchmark.js and registered the directory in the package.json `directories` field. Among the 348 packages in the assert namespace, benchmark/benchmark.js is present in 303 (87.1%); restricting to packages which export a function, is-node-repl was the sole member without a benchmark directory. Repository-wide, 4813 of 5246 function-exporting packages (91.7%) ship benchmark/benchmark.js, whereas 0 of 354 packages exporting a precomputed constant do -- and is-node-repl exports a function, isNodeREPL(), which walks the module parent chain and regex-tests a synthesized V8 stack trace on every call. All 45 sibling assert/has-*-support packages, which likewise export a nullary environment probe returning a boolean, ship a benchmark; this benchmark follows their template. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YbAWkamCVtdUsXqRp6Egag
Planeshifter
force-pushed
the
philipp/drift-assert-2026-09-28
branch
from
September 28, 2026 01:17
00c25a7 to
7d1d566
Compare
The `@param` tag declared `{string}` where the function accepts any
value: the body is `isPrimitive( str ) || isObject( str )`, the tag's
own `@example` blocks pass `[]` and `null` documenting `// returns
false`, and the package's own docs/repl.txt and docs/types/index.d.ts
already declare the parameter as `any`. Among the 220 assert packages
documenting a single value argument, 220 use `@param {*}` and 219
describe it as "value to test"; the two other packages declaring
`{string}` -- has-utf16-surrogate-pair-at and is-anagram -- throw on
non-string input and are correctly typed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YbAWkamCVtdUsXqRp6Egag
The `@returns` description read "ndarray-lik object" and "data typee". The same sentence is spelled correctly in the package's own docs/types/index.d.ts and docs/repl.txt. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YbAWkamCVtdUsXqRp6Egag
"boolean whether" is ungrammatical and was the only such instance in the namespace; 297 of the 322 assert packages documenting a boolean return use "boolean indicating". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YbAWkamCVtdUsXqRp6Egag
assert/is-node-replassert and add a missing benchmark
kgryte
marked this pull request as ready for review
September 28, 2026 01:28
kgryte
approved these changes
Sep 28, 2026
assert and add a missing benchmark
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:
@paramtype inassert/is-well-formed-stringthat contradicts the function's own behavior, examples, and TypeScript declaration.@returnsdescription ofassert/is-ndarray-like-with-data-type.@returnsdescription inassert/is-leap-year.benchmark/benchmark.jstoassert/is-node-repl, the only package in the namespace that exports a function but ships no benchmark.Each is a separate commit. All four are documentation or benchmark additions; no observable behavior changes and no test expectations change.
assert/is-well-formed-stringThe
@paramtag declared{string}, but the function accepts any value: the body isisPrimitive( str ) || isObject( str ), its own@exampleblocks pass[]andnulldocumenting// returns false, and the package'sdocs/repl.txtanddocs/types/index.d.tsalready declare the parameter asany. The JSDoc was the only one of the package's three documentation layers that disagreed. Of the 220assertpackages documenting a single value argument, 220 use@param {*}and 219 describe it as "value to test". The two other packages declaring{string}—has-utf16-surrogate-pair-atandis-anagram— throw on non-string input and are correctly typed, so they are untouched.assert/is-ndarray-like-with-data-typeThe
@returnsdescription read "ndarray-lik object" and "data typee". The same sentence is spelled correctly in the package's owndocs/types/index.d.tsanddocs/repl.txt.assert/is-leap-yearThe
@returnsread "boolean whether a value corresponds to a leap year". "boolean whether" is ungrammatical and was the sole instance in the namespace; 297 of the 322 packages documenting a boolean return use "boolean indicating". The[value]optional marker is correct — the function branches onarguments.lengthand returns the current year's status when called with no arguments — and is left alone.assert/is-node-replis-node-replexportsisNodeREPL(), a function, and had nobenchmark/directory.benchmark/benchmark.jsis present in 303 of 348assertpackages (87.1%); narrowed to packages exporting a function rather than a precomputed value,is-node-replwas the sole omission. The call is not free — it walks themodule.parentchain and, failing that, synthesizes and regex-tests a V8 stack trace — so it is measurably more expensive than thehas-*-supportprobes, all 45 of which ship a benchmark. The new file follows that family's template. The commit also registersbenchmarkin thepackage.jsondirectoriesfield, aslint_package_json_filesrequires.Related Issues
No.
Questions
Three, all concerning findings deliberately left out.
assert/*-arraypackages place their entire implementation — a singlearrayfun( pred )call — directly inlib/index.jswith nolib/main.js, and consequently carry no function-level JSDoc on the export. Six structural twins in the same directory do the opposite;is-truthy-arrayandis-falsy-arrayare byte-for-byte analogous apart from this. Namespace-wide,lib/main.jsis present in 92.8% of packages, but among packages whose implementation is a bare factory call the count runs 20 without to 6 with, so the split is not settled for this shape, anddocs/contributing/packages.mdis permissive ("typically", "most commonly"). Should these twenty be normalized, and in which direction?lib/main.jsanddocs/types/index.d.ts, against a 97.1% intra-package invariant:is-structandis-struct-constructor-like(valuevsv),is-prng-like(vvsvalue),is-binary-string(strvsvalue), andis-alphagram,is-alphanumeric,is-ascii,is-digit-string,is-hex-string(xvsvalue).docs/repl.txtis a third naming layer that disagrees again in most of these, so no single rename reconciles all three, andindex.d.tsis published TypeScript surface. Left alone pending a decision on the target name.is-mobile/lib/browser.jsandis-touch-device/lib/browser.jsexport functions, while their Node entry points export booleans and every siblingbrowser.js(is-browser,is-docker,is-electron,is-electron-main,is-electron-renderer,is-node) exports a plaintrue/false. Sincepackage.jsonbrowsersubstitutes that file formain, those two packages change export shape between builds. This looks like a defect rather than a convention, but fixing it would change observable behavior, so it is out of scope here.Other
Namespace survey. 348 packages in
assert, all hand-maintained (no wholly generated members). Features examined: package file tree,package.jsonkey sets,scripts/stdlibkeys,manifest.jsonkeys, README heading set and order, test/benchmark/example filenames, public signature, return kind, validation prologue, error construction, JSDoc shape, and internal dependencies.Features with a clear ≥75% pattern: file tree,
package.jsontop-level keys (100% on all eighteen), README heading set and order (100% onUsage/Examples),test/test.jspresence, return kind (100% boolean),@examplepresence (100%),@param {*}for a single value argument (220/220), andformatfor thrown validation errors (12/12 packages that throw). Features excluded for having no clear pattern: READMESee Also(69.3%, and generator-populated),Notes(35.6%),CLI(23.3%), public signature (( value )at 45.5% — a plurality only), and internal dependencies (highest single dependency at 11.2%).scriptsis{}in all 348.Validation. Structural features were extracted from the filesystem, semantic features from source. Three agents then audited the dismissals rather than the corrections, which is where a survey like this goes wrong, and each of their findings was re-verified against the tree before being acted on. Two discriminations mattered:
assertpackages exporting a precomputed boolean, false foris-node-repl, which exports a function. Export shape predicts benchmark presence almost perfectly repository-wide — 4813 of 5246 function-exporting packages (91.7%) ship one, against 0 of 354 packages exporting a constant.@param {string}on a value argument looked like three outliers. Only one is:has-utf16-surrogate-pair-atandis-anagramthrow on non-string input, verified at runtime, so their type is right.Also deliberately excluded: three packages whose
@returnsends in a period against a 99.1% norm (is-complex-like,is-even,is-odd) — an inconsistency, but not a defect, and not worth churn; the twenty-four packages using the terser "boolean result" phrasing, which is the norm for the( v1, v2 )comparison cluster and so has no unambiguous direction; the fifteen constant-exporting packages with no benchmark; the twenty-nine packages shippingbenchmark.length.js, which have real length-parameterized coverage;is-absolute-pathandis-relative-path, whoseposix.js/win32.jsbranch files are required directly by their tests, so promoting either tomain.jswould be a breaking rename; and thenapiandtoolssub-namespace containers.Local validation. All four modified files pass
node --check. Thedirectorieslint thatlint_package_json_filesruns was reproduced locally and confirmed idempotent for all four packages. The benchmark file differs fromhas-symbol-support/benchmark/benchmark.jsonly in the copyright year, one require's variable name, and the call site.@stdlib/benchand ESLint could not be run — third-party dependencies are absent in the authoring environment, and the pre-existinghas-symbol-supportbenchmark fails identically — so the harness was not executed. CI is the gate for those.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written by Claude Code as part of an automated survey of convention consistency across the
assertnamespace. The survey, the four changes, and this description were all produced by Claude Code. The benchmark harness and ESLint could not be executed in the authoring environment, so reviewers should rely on CI for those. The three questions above are open and have not been acted on.@stdlib-js/reviewers