Lodash _(value) Method

Beginner
⏱️ 7 min read
📚 Updated: Jul 2026
🎯 6 Examples + 3 Try It
Seq & chaining

What You’ll Learn

By the end of this tutorial, you’ll use _(value) as Lodash’s shorthand wrapper to build readable pipelines and unwrap with .value().

01

Shorthand wrap

_(value) starts a wrapper.

02

Same as chain

Equivalent to _.chain(value).

03

Fluent steps

Chain map, filter, sortBy, pick.

04

Always unwrap

Finish with .value().

05

_ vs _.map

Wrapper factory vs direct calls.

06

Seq family

Next: wrapper prototype and _.tap().

What Is _(value)?

_(value) is Lodash’s shorthand wrapper entry point. Call the main _ function with any value to get a sequence wrapper—the same kind of object _.chain(value) returns. Then call chainable Lodash methods one after another in a fluent pipeline.

💡
Two roles for _

_ is both the Lodash namespace (_.map, _.filter) and a callable wrapper factory. Use _(value) when you want chaining; use _.map(value, fn) for a single direct call.

Use _(value) when you prefer concise syntax for multi-step pipelines, when your team already reads Lodash chains fluently, or when three or more Lodash steps would otherwise nest inside each other.

📝 Syntax

The signature takes one argument—the value to wrap:

javascript
_(value)

Syntax Rules

  • value — any value to wrap (array, object, number, etc.).
  • Return value — a Lodash wrapper; chainable methods return another wrapper.
  • Unwrap — call .value() or .valueOf() for the final result.
  • Equivalent entry_(value) and _.chain(value) start the same wrapper type.
  • Not lazy — steps run when you unwrap, not as an infinite stream.
javascript
import _ from "lodash";

const data = [1, 2, 3, 4, 5];
const result = _(data)
  .map(function (x) { return x * 2; })
  .filter(function (x) { return x > 5; })
  .value();

// result -> [6, 8, 10]

⚡ Quick Reference

TaskCode patternResult
Start a pipeline_(array)Lodash wrapper
Map then filter_(x).map(...).filter(...)Still a wrapper
Get final result... .value()Plain JS value
Explicit wrap_.chain(value)See _.chain()
Direct call (no wrap)_.map(value, fn)Plain result immediately
Side-effect peek.tap(fn)See _.tap()
Shorthand
_(x)

Wrap + chain

Explicit
_.chain(x)

Same wrapper

Direct
_.map(x, fn)

No wrapper

🧰 Parameters

The single argument to _(value) and what the pipeline returns:

value Required

The initial value wrapped in a Lodash sequence (array, object, etc.).

_([1, 2, 3, 4, 5])
return value Wrapper

A Lodash wrapper exposing chainable methods until you call .value().

_(x).map(...)
.value() Unwrap

Executes the pipeline and returns the plain JavaScript result.

.value() // -> [4, 6]
_ vs _.chain Equivalent

_(value) and _.chain(value) start the same wrapper for chaining.

_(data) === _.chain(data) // same type

Import the main lodash package so _ is both the namespace and the wrapper factory.

Examples Gallery

Practical _(value) patterns with sample output and interactive Try It Yourself labs.

📚 Getting Started

Wrap with _(value), chain methods, unwrap with .value().

Example 1 — Basic wrap and map

Wrap an array, double each element, unwrap the result.

javascript
const wrappedArray = _([1, 2, 3]);

const result = wrappedArray
  .map(function (x) { return x * 2; })
  .value();

console.log(result);
// -> [2, 4, 6]
Try It Yourself

How It Works

_([1, 2, 3]) returns a wrapper; .map returns another wrapper until .value() executes the pipeline.

Example 2 — Map, filter, and unwrap

A fluent multi-step pipeline using the shorthand wrapper syntax.

javascript
const data = [1, 2, 3, 4, 5];

const result = _(data)
  .map(function (x) { return x * 2; })
  .filter(function (x) { return x > 3; })
  .value();

console.log(result);
// -> [4, 6, 8, 10]
Try It Yourself

📈 Practical Patterns

Equivalence with chain, object pipelines, reuse, and direct calls.

Example 3 — _(value) vs _.chain(value)

Both entry points produce the same wrapper and the same final result.

javascript
const data = [1, 2, 3, 4, 5];

const shorthand = _(data)
  .map(function (x) { return x * 2; })
  .filter(function (x) { return x > 5; })
  .value();

const explicit = _.chain(data)
  .map(function (x) { return x * 2; })
  .filter(function (x) { return x > 5; })
  .value();

console.log(JSON.stringify(shorthand) === JSON.stringify(explicit));
// -> true
Try It Yourself

Example 4 — Wrap an object and pick public fields

_(value) works on objects too—not just arrays.

javascript
const user = {
  name: "Alice",
  age: 30,
  email: "alice@example.com",
  isAdmin: true
};

const publicProfile = _(user)
  .pick(["name", "age"])
  .value();

console.log(publicProfile);
// -> { name: "Alice", age: 30 }

Example 5 — Reuse one wrapper for different chains

Start from the same wrapped value and branch into separate pipelines.

javascript
const wrapped = _([1, 2, 3]);

const doubled = wrapped.map(function (x) { return x * 2; }).value();
const squared = wrapped.map(function (x) { return x * x; }).value();

console.log(doubled);
// -> [2, 4, 6]
console.log(squared);
// -> [1, 4, 9]

🚀 Beyond the Basics

When to wrap vs call Lodash directly.

Example 6 — _(value) vs direct _.map()

For a single transform, a direct call is often clearer than wrapping.

javascript
const data = [1, 2, 3];

const wrapped = _(data).map(function (x) { return x + 1; }).value();
const direct = _.map(data, function (x) { return x + 1; });

console.log(JSON.stringify(wrapped) === JSON.stringify(direct));
// -> true

// Prefer direct calls for one step; use _(value) for multi-step pipelines.

🧠 How _(value) Works

1

Call the wrapper factory

_(value) invokes Lodash as a function, wrapping your array, object, or primitive in a sequence object.

Input
2

Chain methods fluently

Each chainable method (map, filter, pick, etc.) returns another wrapper with the next step queued.

Pipeline
3

Unwrap when done

.value() executes all queued steps and returns plain JavaScript data you can pass to other code.

Unwrap
=

Same wrapper as chain

_(value) and _.chain(value) produce the same wrapper type—pick whichever reads better in your codebase.

📝 Notes

  • _(value) returns a wrapper, not transformed data—always call .value() (or .valueOf()) to finish.
  • _ is dual-purpose: the Lodash namespace (_.map) and the wrapper factory (_(x)).
  • _.chain(value) is the explicit equivalent—same behavior, different syntax.
  • Chaining improves readability for multi-step pipelines; single-step work is often clearer as _.map(value, fn).
  • For side effects between steps, use _.tap(); for custom transforms, use _.thru().
  • Wrapper prototype helpers like .value() live on the object returned by _(value).

Conclusion

_(value) is Lodash’s concise shorthand for starting a method chain. Wrap your data, call chainable helpers in order, and unwrap with .value() to get a plain result. It is ideal when you want fluent pipelines without the extra verbosity of _.chain().

Next in the series: wrapper prototype methods that control unwrapping, cloning, and advanced chain behavior—starting with .value().

💡 Best Practices

✅ Do

  • Use _(value) for multi-step Lodash pipelines that read top-to-bottom
  • End every chain with .value() before passing data elsewhere
  • Prefer direct _.map / _.filter for one-off single-step transforms
  • Extract long pipelines into named functions for easier testing
  • Use _.tap() for debug logging without changing pipeline output

❌ Don’t

  • Confuse _(value) with calling _.map(value, fn)—different patterns
  • Forget .value() and treat the wrapper as a plain array or object
  • Wrap values when a single direct Lodash call is enough
  • Assume _(value) is lazy streaming—unwrap runs steps eagerly
  • Reuse a wrapper after .value() without understanding wrapper state

Key Takeaways

Knowledge Unlocked

Five things to remember about _(value)

Use these when wrapping data for fluent Lodash pipelines.

5
Core concepts
🔗 02

Same as chain

_.chain(x) too.

Equivalent
📦 03

Always unwrap

.value() required.

Critical
📈 04

_ dual role

Wrap + namespace.

Concept
🛠️ 05

Know when

3+ steps vs direct.

Guideline

❓ Frequently Asked Questions

_(value) wraps any value in a Lodash sequence wrapper so you can call chainable methods like map, filter, and pick in a fluent pipeline, then unwrap with .value().
For starting a sequence, yes—they create the same kind of wrapper. _.chain(value) is explicit; _(value) is the concise shorthand many Lodash codebases use.
Chained steps return another wrapper until you unwrap. .value() (or .valueOf()) runs the pipeline and returns the final plain array, object, or number.
Yes. Calling _(value) alone just wraps the value. You can also call plain Lodash methods like _.map(value, fn) without wrapping—use _(value) when you want fluent multi-step chains.
_ is both the main Lodash namespace (_.map, _.filter) and a callable wrapper factory. _(x).map(...) chains on the wrapper; _.map(x, fn) is a single direct call.
They behave the same for starting chains. Choose _(value) for shorter syntax in fluent pipelines, or _.chain(value) when you want the entry point to read explicitly in code reviews.
Did you know?

In Lodash, the same symbol _ is both the utility namespace and a callable wrapper factory. Calling _(value) is the shortest way to start the same sequence object that _.chain(value) creates—many codebases use _(data).map(...).value() for its brevity.

Practice _(value) in the Live Editor

Wrap arrays, build map/filter pipelines, and compare with _.chain() instantly.

Open Try It editor →

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