Lodash _.valuesIn() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Creates an array of the own and inherited enumerable string-keyed property values of object. Part of Lodash 4.x Object.

Pass the object and path or keys shown below. Check whether the helper mutates or returns a new object.

Syntax

Call _.valuesIn. Start with this line.

Lodash
_.valuesIn(object)
CallWhat it does
_.valuesIn(object)Primary signature.

Prefer import valuesIn from "lodash/valuesIn" when you want a smaller bundle.

Library declarations
Lodash
_.valuesIn(object)

Parameters

ParameterDescription
objectRequired. Object to query

Return Value

Return ValueDescription
*New array of values (own + inherited)

Lodash Examples

Example 1 — Official Foo Instance

Own fields plus an inherited prototype value.

Lodash
function Foo() {
  this.a = 1;
  this.b = 2;
}
Foo.prototype.c = 3;

_.valuesIn(new Foo);
// → [1, 2, 3]
Try It Yourself

How It Works

  1. Own. Instance has a and b.
  2. Inherited. Prototype adds enumerable c.
  3. Collect. Values become 1, 2, then 3.
  4. Result. New array — object unchanged.

Example 2 — vs _.values

Own-only vs own + inherited.

Lodash
function Foo() {
  this.a = 1;
  this.b = 2;
}
Foo.prototype.c = 3;

var obj = new Foo();

_.values(obj);
// → [1, 2]        // own only

_.valuesIn(obj);
// → [1, 2, 3]     // own + inherited
Try It Yourself

How It Works

  1. values. Stops at own enumerable keys.
  2. valuesIn. Continues up the prototype chain.
  3. c. Appears only in the valuesIn result.
  4. Choose. Use values when prototypes should stay hidden.

Example 3 — null and undefined

Nullish input is safe — empty array, no throw.

Lodash
_.valuesIn(null);
// → []

_.valuesIn(undefined);
// → []

_.valuesIn({});
// → []
Try It Yourself

How It Works

  1. Guard. Nullish becomes [].
  2. Empty object. No enumerable keys → [].
  3. Native. Object.values(null) throws — Lodash does not.
  4. Safe. Handy when data may be missing.

Example 4 — Object.create Chain

Inherited values from a custom prototype object.

Lodash
var proto = { shared: "hello" };
var child = Object.create(proto);
child.own = 42;

_.values(child);
// → [42]

_.valuesIn(child);
// → [42, "hello"]
Try It Yourself

How It Works

  1. Proto. shared lives on the prototype.
  2. Own. own is set on the child.
  3. values. Sees only 42.
  4. valuesIn. Includes "hello" too.

Example 5 — Pair with _.keysIn

Keys and values from the same inherited walk.

Lodash
function Foo() {
  this.a = 1;
  this.b = 2;
}
Foo.prototype.c = 3;

var obj = new Foo();

_.keysIn(obj);
// → ["a", "b", "c"]

_.valuesIn(obj);
// → [1, 2, 3]

_.toPairsIn(obj);
// → [["a", 1], ["b", 2], ["c", 3]]
Try It Yourself

How It Works

  1. keysIn. Names of own + inherited enumerable keys.
  2. valuesIn. Matching values in the same walk family.
  3. toPairsIn. Combined [key, value] entries.
  4. Pick. Use the shape you need for map/filter/reduce.

Browser & Runtime Support

_.valuesIn is a Lodash 4.x Object helper. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native cousins: Object.values (own only) or a for…in loop that pushes values.

✓ Stable · Lodash 4.x

_.valuesIn()

Available in [email protected] full builds and the lodash/valuesIn modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 4.x
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
_.valuesIn Lodash 4.x+

Bottom line: Safe for production once Lodash is loaded. Prefer import valuesIn from "lodash/valuesIn" for smaller builds. Use when inherited enumerable values must be included.

Frequently Asked Questions

It returns an array of an object's own and inherited enumerable string-keyed property values. Official: _.valuesIn(new Foo) → [1, 2, 3] when Foo has a=1, b=2 and prototype c=3.
_.values() returns only own enumerable values. _.valuesIn() also includes inherited enumerable values from the prototype chain.
No. It returns a new array. The source object is unchanged.
Lodash returns []. Native Object.values(null) throws.
Own keys follow insertion-style order for plain objects, but inherited values follow a for…in-style walk — do not rely on a fixed global order across engines.
keysIn returns the matching keys; valuesIn returns the matching values. toPairsIn returns [key, value] pairs including inherited.

Next: Lodash Seq

Continue with wrapping, chaining, and sequence helpers.

Seq methods hub →

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.

9 people found this page helpful