_(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.
Foundation
📝 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]
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.
_(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.
Important
📝 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).
Wrap Up
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().
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
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about _(value)
Use these when wrapping data for fluent Lodash pipelines.
5
Core concepts
🔗01
Shorthand wrap
_(value)
Core
🔗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.