Ramda’s R.min() answers a selection question: which of two ordered values is smaller? You pass two values and get back one of them — the smaller. It uses JavaScript’s ordering rules under the hood, so numbers, strings, and Dates all work. It is not a Boolean test — cousins R.lt and R.lte tell you whether ordering holds. R.max picks the larger value; R.minBy picks by a computed key. R.clamp uses ordering internally to bound a value. Previous helper is R.maxBy. Next is R.minBy.
The official samples cover the whole idea. R.min(789, 123) returns 123. R.min('a', 'b') returns 'a' because 'a' is lexicographically smaller. The result is always one of the two inputs, ready to pipe forward.
Syntax
Call R.min. Start with this line.
Ramda
R.min(a, b)
Call
What it does
R.min(a, b)
Primary signature.
R.min(...)
Call the relation helper.
Prefer import { min } from "ramda" when you want a named import.
Library declarations
Ramda
R.min(a, b)
Parameters
Parameter
Description
a
Required. Ord. First ordered value. One of a or b is returned. Not mutated.
b
Required. Ord. Second ordered value to compare against. Not mutated.
Return Value
Return Value
Description
Ord (same type as inputs)
The smaller of a and b. Always one of the two inputs, never a Boolean.
Ramda Examples
📚 Getting Started
The official Ramda samples for numbers and strings.
Example 1 — Official Number and String Samples
Numbers and strings from the Ramda docs. R.min returns the smaller value itself.
All three helpers read the same pair, but answer different questions. R.min gives you the smaller value to use downstream. R.max returns the larger value; R.lt returns a Boolean test result.
📈 Practical Patterns
Reduce minimum, cap-at-100 with placeholder, then earlier Date selection.
Example 3 — Minimum of a List with R.reduce
Fold a list to its smallest element. R.min is the combiner; Infinity is the identity for numbers.
R.reduce walks the list left to right, keeping the running minimum. Each step compares the accumulator with the next element via R.min. The final accumulator is -1.
Example 4 — Cap Upper Bound with R.min(R.__, 100)
Fix the ceiling at 100 with the placeholder. Each list element is compared against 100; the smaller value is kept.
JavaScript coerces Dates to numbers when compared. January 2024 is earlier than June 2024, so the January Date object is returned. Use the result directly in pipelines that need the earliest timestamp.
Compatibility
Browser Support
R.min() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.min()
Load Ramda 0.1.0 or later via CDN or npm, then call R.min with two ordered values. No extra browser API is required.
100%With Ramda 0.1.0+
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.min()Universal
Bottom line: Safe in any project that includes Ramda 0.1.0 or later. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node. These labs use [email protected].
Frequently Asked Questions
R.min(a, b) returns the smaller of its two arguments — the value itself, not a Boolean. Type: Ord a => a → a → a. Arity 2, curried. Added in v0.1.0.
R.min(789, 123) returns 123. R.min('a', 'b') returns 'a'. The result is always one of the two inputs.
R.min returns the smaller value. R.lt and R.lte return true or false about ordering. On (789, 123), R.min gives 123 while R.lt and R.lte give false.
R.max returns the larger value. R.minBy(fn, a, b) picks the smaller by a computed key via fn. R.min compares the values directly.
Yes. Any ordered type that JavaScript can compare works — numbers, strings (lexicographic), and Dates (by time value). R.min picks the earlier or lexicographically smaller value.
No. R.min is a stable Ramda relation helper from v0.1.0. It is not deprecated, experimental, or non-standard.