Ramda.js R.min() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Relation

Definition

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)
CallWhat 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

ParameterDescription
aRequired. Ord. First ordered value. One of a or b is returned. Not mutated.
bRequired. Ord. Second ordered value to compare against. Not mutated.

Return Value

Return ValueDescription
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.

Ramda
R.min(789, 123);
//=> 123

R.min('a', 'b');
//=> 'a'
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. 123 is less than 789, so 123 is returned. Strings compare lexicographically: 'a' < 'b', so 'a' is returned.

Example 2 — vs R.max and R.lt on the Same Pair

Compare value pickers with Boolean tests on (789, 123). Highlight: R.min returns the value; R.lt returns a Boolean.

Ramda
R.min(789, 123);
//=> 123

R.max(789, 123);
//=> 789

R.lt(789, 123);
//=> false
Try It Yourself

How It Works

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.

Ramda
R.reduce(R.min, Infinity, [3, -1, 7, 2]);
//=> -1
Try It Yourself

How It Works

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.

Ramda
R.map(R.min(R.__, 100), [50, 120, 80, 200]);
//=> [50, 100, 80, 100]
Try It Yourself

How It Works

R.min(R.__, 100) waits for the first argument. R.map passes each element. Values above 100 are capped; values at or below pass through unchanged.

Example 5 — Pick the Earlier Date

Dates are ordered by their time values. R.min returns the earlier Date object.

Ramda
R.min(new Date('2024-06-01'), new Date('2024-01-01'));
//=> Date('2024-01-01')
Try It Yourself

How It Works

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.

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 Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All 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.

Continue to R.minBy()

Pick the smaller of two values by projection — scores, magnitudes, and the R.reduce minimum-by-key pattern.

R.minBy() Method →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful