Ramda.js R.T() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.T is a function that always returns true. Any arguments you pass are ignored (official Ramda docs).

Stable since v0.9.0: R.T is not deprecated, experimental, or non-standard. Its opposite is R.F.

Syntax

Call R.T. Start with this line.

Ramda
R.T()
CallWhat it does
R.T()Primary signature.
R.T(...)Call the function helper.

Prefer import { t } from "ramda" when you want a named import.

Library declarations
Ramda
R.T()

Parameters

This helper has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The value returned by R.T().

Ramda Examples

Example 1 — Official Sample

Call R.T with nothing, or with anything — the answer is always true.

Ramda
console.log(R.T());               // true
console.log(R.T(0, 'a', null));    // true
console.log(R.T(false));           // true
Try It Yourself

How It Works

  1. No arguments. R.T() → true, the sample from the Ramda docs.
  2. Many arguments. 0, 'a', and null are ignored → true.
  3. Even false. R.T(false) doesn’t look at its input → true.

Example 2 — Catch-All Branch in R.cond

Put R.T in the last pair so every value gets an answer.

Ramda
const classify = R.cond([
  [R.lt(R.__, 10), R.always('cold')],
  [R.gt(R.__, 25), R.always('hot')],
  [R.T,            R.always('mild')]
]);

console.log(classify(5));  // "cold"
console.log(classify(30)); // "hot"
console.log(classify(18)); // "mild"
Try It Yourself

How It Works

  1. Top to bottom. R.cond tries each [predicate, transform] pair in order.
  2. 5 and 30. R.lt(R.__, 10) (x < 10) matches 5; R.gt(R.__, 25) (x > 25) matches 30.
  3. 18. Both checks are false, so R.cond reaches R.T, which is always true.
  4. Result. R.always('mild') runs → 'mild'. Without R.T, 18 would give undefined.

Example 3 — Keep or Drop Everything

Used as a predicate, R.T keeps every item in R.filter and removes every item in R.reject.

Ramda
const nums = [1, 2, 3];

console.log(R.filter(R.T, nums)); // [1, 2, 3]
console.log(R.reject(R.T, nums)); // []
Try It Yourself

How It Works

  1. Filter. R.filter keeps items where the predicate is true. R.T says true for each → all 3 kept.
  2. Reject. R.reject removes items where the predicate is true → nothing left.
  3. New array. R.filter(R.T, nums) returns a fresh copy; nums is unchanged.

Example 4 — A Default “Accept All” Predicate

When a caller gives no condition, fall back to R.T so nothing is filtered out.

Ramda
const filterBy = (pred = R.T) => R.filter(pred);

console.log(filterBy()([1, 2, 3]));         // [1, 2, 3]
console.log(filterBy(R.lt(1))([1, 2, 3]));  // [2, 3]
Try It Yourself

How It Works

  1. Default. pred = R.T is used when no predicate is passed.
  2. No condition. filterBy() becomes R.filter(R.T) → keeps [1, 2, 3].
  3. With a condition. R.lt(1) means 1 < x → keeps [2, 3].
  4. Why. No if check is needed for the “no filter” case.

Example 5 — R.T vs R.F vs R.always(true)

Three constant functions side by side.

Ramda
console.log(R.T('anything'));            // true
console.log(R.F('anything'));            // false
console.log(R.always(true)('anything')); // true
Try It Yourself

How It Works

  1. R.T. Ignores 'anything' → true.
  2. R.F. R.F is the opposite → false.
  3. R.always(true). Builds a function that returns true → same result as R.T.
  4. Pick. Use R.T / R.F for booleans; use R.always for any other constant.

Browser & Runtime Support

R.T() is a one-line JavaScript function inside Ramda 0.9.0+. No special browser API is needed.

✓ Ramda 0.9.0+ · Any JS runtime

Ramda.js R.T()

The UMD build (ramda.min.js) is compiled to ES5 syntax, so it runs in Chrome, Firefox, Safari, and Edge, and in Node.js, Deno, and Bun.

100% With Ramda loaded
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
R.T() Universal

Bottom line: Safe in any project with Ramda 0.9.0 or later (check with npm ls ramda). Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Deno, and Bun. These labs load [email protected].

Frequently Asked Questions

R.T is a function that always returns true. Any arguments you pass are ignored, so R.T(), R.T(0), and R.T(1, 'a', null) all return true.
R.T(); //=> true. The docs describe it as a function that always returns true, ignoring any passed-in parameters. It was added in v0.9.0.
Most often as the last, catch-all pair in R.cond: [R.T, R.always('default')]. It also works as a keep-everything predicate for R.filter or as a default predicate when a caller gives none.
They behave the same: both return true for any input. R.T is a ready-made, shorter name, so you don't create a new function each time.
R.T is a function, true is a boolean. Pass R.T where a function is expected (predicates, R.cond). Passing R.T() (the value true) to R.filter throws TypeError: fn is not a function.
No. R.T has been a stable Ramda function since v0.9.0. It is not deprecated, experimental, or non-standard.

Next: R.tap()

Peek at a value in a pipeline (for logging) without changing it.

R.tap() tutorial →

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