feat(lodash): add max/min/maxBy/minBy/clamp/inRange/random to manifest#982
Merged
Conversation
- New runtime exports js_lodash_max/_min/_max_by/_min_by in
perry-stdlib (clamp/in_range/random already existed).
- Manifest rows for all seven (max/min/maxBy/minBy/clamp/inRange/random).
- NativeModSig rows for the six new dispatches in lower_call.rs
(clamp was already there).
- declare_function decls for the four new symbols
(clamp/in_range/random already declared).
- test-files/test_lodash_max_min.ts matches node --experimental-strip-types
byte-for-byte: 5 / 1 / { n: 5 } / { n: 1 } / 5 / 0 / 3 / true / false.
maxBy/minBy currently accept the property-shorthand iteratee form only;
function iteratees return undefined until closure-call plumbing across
the FFI boundary lands as a follow-up (same restriction as sumBy/meanBy
from PR #966).
2 tasks
proggeramlug
added a commit
that referenced
this pull request
May 18, 2026
PRs #966, #967, #982, #984 added entries to perry-api-manifest::API_MANIFEST (stream EventEmitter instance methods, stream.prototype, lodash inRange/max/maxBy/mean/meanBy/min/minBy/random/sum/sumBy/tail) without rerunning ./scripts/regen_api_docs.sh. Drift has been blocking the api-docs-drift gate on every subsequent PR; unblocking the next batch. Coverage moves from 870 → 898 entries across 71 modules. Mechanical regen, no manifest edits.
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.
Summary
Direct follow-up to PR #966 (sum/mean/sumBy/meanBy/head/last/tail). After #966 unblocked
lodash.sum, the next bare-lodash sweep tripped on_.max:This PR adds the seven extrema + utility methods end-to-end (runtime + manifest + codegen wiring).
crates/perry-stdlib/src/lodash.rs): newjs_lodash_max/js_lodash_min/js_lodash_max_by/js_lodash_min_by.clamp/in_range/randomruntime helpers already existed.crates/perry-api-manifest/src/entries.rs): seven newmethod_sigrows.crates/perry-codegen/src/lower_call.rs): six newNativeModSigrows (clampwas already wired).crates/perry-codegen/src/runtime_decls.rs): four newdeclare_functionrows (the existing three:clamp/in_range/randomwere already declared).max([])/min([])/maxBy([], 'k')/minBy([], 'k')returnundefined(NaN-boxed).maxBy/minByaccept the property-shorthand iteratee form only — same restriction assumBy/meanByfrom #966; function iteratees returnundefineduntil closure-call plumbing across the FFI boundary lands as a follow-up.Test plan
test-files/test_lodash_max_min.tsmatchesnode --experimental-strip-typesbyte-for-byte:cargo fmt --allcleancargo build --release -p perry-runtime -p perry-stdlib -p perrycleantest-files/test_lodash_sum.tsstill passes (10 / 2.5 / 3 / 1 / 3) — no regressionKnown follow-up
compilePackages: ["lodash"](compile lodash fromnode_modulesrather than dispatching through the native manifest) crashes at runtime withTypeError: Cannot read properties of undefined (reading 'call')— same V8-fallback-style issue blocking other compile-as-package smokes (#678 territory), unrelated to this PR. The bare-import path (which is what the manifest + native dispatch is actually for) works correctly.