Ramda.js R.valuesIn() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Ramda’s R.valuesIn() answers a chain question: which enumerable values exist on this object or anywhere up its prototype? You pass an object. You get an array of values. Own enumerable data counts. Inherited enumerable data counts. Non-enumerable fields such as toString do not.

The official sample is the whole idea. A constructor writes this.x = 'X'. y is assigned on the prototype as 'Y'. R.valuesIn(f) is ['X', 'Y']. Native JavaScript is a for…in loop that reads obj[prop]. That throws on null. valuesIn does the same, because the source is that loop. Need own data only, and a quiet [] on null? That is the previous helper, R.values. Need the names on the chain? That is R.keysIn. Need both as pairs? That is R.toPairsIn. Next Object helper is R.view.

Syntax

Call R.valuesIn. Start with this line.

Ramda
R.valuesIn(obj)
CallWhat it does
R.valuesIn(obj)Primary signature.
R.valuesIn(...)Call the object helper.

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

Library declarations
Ramda
R.valuesIn(obj)

Parameters

ParameterDescription
objRequired. Object. The record to inspect. Arrays work: items come back as the list. null and undefined throw, because for…in cannot walk them.

Return Value

Return ValueDescription
Array of valuesEnumerable own values plus enumerable prototype values. The docs note that order is not guaranteed across JS platforms. The source object is not mutated.

Ramda Examples

📚 Getting Started

The official constructor sample, then the same instance compared with own-only values.

Example 1 — Official Instance Values

Own X and enumerable prototype Y both appear.

Ramda
const F = function () { this.x = 'X'; };
F.prototype.y = 'Y';
const f = new F();
R.valuesIn(f);
//=> ['X', 'Y']
Try It Yourself

How It Works

x is assigned on the instance as 'X'. y is an enumerable field on F.prototype as 'Y'. for…in visits both and valuesIn pushes the data. That is the docs sample from ramdajs.com.

Example 2 — vs R.values and R.keysIn

valuesIn sees prototype data. values does not. keysIn lists the names instead.

Ramda
const F = function () { this.x = 'X'; };
F.prototype.y = 'Y';
const f = new F();
R.valuesIn(f);
//=> ['X', 'Y']
R.values(f);
//=> ['X']
R.keysIn(f);
//=> ['x', 'y']
Try It Yourself

How It Works

R.values walks own enumerable names (via keys). valuesIn uses for…in and pushes obj[prop]. JSON field lists almost always want values. Enumerable prototype defaults almost always want valuesIn. Need the names? That is R.keysIn.

📈 Practical Patterns

Object.create defaults, a null throw compared with values, then a join in a pipe.

Example 3 — Object.create and Empty Object

Inherited enumerable defaults appear. An empty object does not list toString.

Ramda
const proto = { role: 'dev' };
const child = Object.create(proto);
child.name = 'Ada';
R.valuesIn(child);
//=> ['Ada', 'dev']
R.values(child);
//=> ['Ada']

R.valuesIn({});
//=> []
Try It Yourself

How It Works

dev is enumerable on the prototype, so valuesIn includes it. Object.prototype.toString is usually non-enumerable, so {} still prints [].

Example 4 — null Throws

valuesIn has no nil guard. values returns [] instead.

Ramda
try {
  R.valuesIn(null);
} catch (err) {
  err.name;
}
//=> 'TypeError'

R.values(null);
//=> []
Try It Yourself

How It Works

for (prop in null) throws. valuesIn does not catch that. Mixed JSON lists that may contain holes should use R.values, or guard with R.isNil first.

Example 5 — Join with pipe

Join enumerable values on the chain. Arrays list the items, not the indexes.

Ramda
const F = function () { this.x = 'X'; };
F.prototype.y = 'Y';
const f = new F();
const joinChain = R.pipe(R.valuesIn, R.join(' '));
joinChain(f);
//=> 'X Y'

R.valuesIn(['a', 'b']);
//=> ['a', 'b']
Try It Yourself

How It Works

Arity 1 makes valuesIn a clean first step in a pipe. Array indexes are enumerable own keys, so a dense array looks the same as R.values unless something enumerable was added on Array.prototype.

Browser Support

R.valuesIn() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.

✓ Ramda 0.2.0+ · Any JS runtime

Ramda.js R.valuesIn()

Load Ramda 0.2.0 or later via CDN or npm, then call R.valuesIn with an object. No extra browser API is required.

100% With Ramda 0.2.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.valuesIn() Universal

Bottom line: Safe in any project that includes Ramda 0.2.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.valuesIn(obj) returns an array of enumerable property values on obj, including values inherited from the prototype. Non-enumerable fields such as toString are skipped. Added in v0.2.0.
A constructor assigns this.x = 'X' and sets F.prototype.y = 'Y'. For an instance f, R.valuesIn(f) is ['X', 'Y'].
values lists own enumerable data only. valuesIn is a for-in loop that pushes obj[prop], so enumerable prototype values count too. keysIn lists the names from that same walk.
R.valuesIn(null) and R.valuesIn(undefined) throw, because for-in cannot walk null. R.values(null) returns [] instead.
No. Object.prototype.toString is usually non-enumerable, so R.valuesIn({}) is []. Only values that for-in would visit appear.
No. R.valuesIn is a stable Ramda object helper from v0.2.0. It is not deprecated, experimental, or non-standard.

Continue to R.view()

Learn how to read one focused slot through a lens using Ramda R.view().

R.view() 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