Lodash Wrapper Prototype Methods

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

What You’ll Learn

By the end of this guide, you’ll know which wrapper prototype methods finish, extend, or clone a Lodash chain—and when to use each.

01

Not _.prototype()

Methods on the wrapper object.

02

.value()

Unwrap to plain data.

03

.commit()

Eager run, keep wrapper.

04

.plant()

Clone chain, new value.

05

.next() / .reverse()

Iterate or mutate in chain.

06

Method index

Links to each deep-dive tutorial.

What Is the Wrapper Prototype?

When you call _.chain(value) or _(value), Lodash returns a wrapper object—not plain data. That wrapper exposes chainable Lodash methods (map, filter, etc.) and special prototype methods that control the pipeline itself: .value(), .commit(), .plant(), and others.

💡
Common misconception

There is no callable _.prototype() function in Lodash. “Wrapper prototype” means the methods attached to the sequence wrapper—documented under /lodash/seq/prototype/... on this site.

Think of wrapper prototype methods as the steering wheel of a chain: collection helpers move the data; prototype helpers decide when to unwrap, re-run, clone, or iterate the wrapper itself.

📝 Syntax

Prototype methods are called on the wrapper returned by a chain entry point:

javascript
_(value)
  .map(/* ... */)
  .filter(/* ... */)
  .value();   // unwrap — most common finish

// Other prototype methods:
.commit();   // run pending steps, return wrapper
.plant(newValue);
.next();
.reverse();

Syntax Rules

  • Call on wrapper — prototype methods are .value() style, not _.value() namespace calls.
  • .value() / .valueOf() — aliases; both unwrap and return plain JavaScript data.
  • .commit() — executes queued actions but returns another wrapper for hybrid chaining.
  • .plant(value) — clones the chain state with a different wrapped value.
  • Chain first — start with _(value) or _.chain(value), then call collection methods, then a prototype method.
javascript
import _ from "lodash";

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

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

⚡ Quick Reference

TaskCode patternResult
Unwrap result.value()Plain JS value
Eager + keep wrapper.commit()Wrapper (hybrid chains)
Clone with new data.plant(value)New wrapper
Lazy step.next()Iterator advance
Reverse in place.reverse()Wrapper (mutates array)
Alias unwrap.valueOf()Same as .value()
Unwrap
.value()

Most common

Hybrid
.commit()

Run + re-chain

Clone
.plant(x)

New wrapped value

🧰 Parameters

Core wrapper prototype methods and what each returns:

.value() Essential

Executes the chain and returns the unwrapped plain result. Alias: .valueOf().

_(data).map(...).value()
.commit() Hybrid

Runs pending actions eagerly but returns the wrapper so you can keep chaining.

.map(...).commit().filter(...)
.plant(value) Clone

Creates a chain clone at the same stage with a different wrapped value.

.map(...).plant(otherData)
.next() / .reverse() Advanced

.next() advances lazy iteration; .reverse() mutates the wrapped array in place.

.reverse().value()

Individual tutorials: /lodash/seq/prototype/{method} (for example /lodash/seq/prototype/value).

Examples Gallery

Practical wrapper prototype patterns with sample output and interactive Try It Yourself labs.

📚 Getting Started

Unwrap with .value() and .valueOf()—the methods you use most.

Example 1 — Unwrap with .value()

Finish a chain and get a plain array back.

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

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

How It Works

.value() executes all queued chain steps and returns plain JavaScript data—not a wrapper.

Example 2 — .valueOf() is an alias

Lodash wrappers also unwrap when coerced to a primitive via .valueOf().

javascript
const wrapped = _([1, 2, 3]).map(function (n) { return n + 1; });

const viaValue = wrapped.value();
const viaValueOf = _([1, 2, 3]).map(function (n) { return n + 1; }).valueOf();

console.log(JSON.stringify(viaValue) === JSON.stringify(viaValueOf));
// -> true

📈 Practical Patterns

Hybrid chaining with commit, cloning with plant, and in-chain reverse.

Example 3 — .commit() for hybrid chaining

Run pending steps eagerly but stay on the wrapper for more chain methods.

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

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

Example 4 — .plant() reuses a chain on new data

Clone the pipeline stage and swap in a different array.

javascript
const template = _([1, 2, 3]).map(function (x) { return x * 2; });

const fromFirst = template.value();
// -> [2, 4, 6]

const fromSecond = template.plant([10, 20]).value();
// -> [20, 40]
Try It Yourself

Example 5 — .reverse() inside a chain

Reverse the wrapped array in place before unwrapping.

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

const reversed = _(data)
  .reverse()
  .value();

console.log(reversed);
// -> [3, 2, 1]

Caution

.reverse() mutates the underlying array. Clone first with _.clone or spread if you need the original order preserved.

🚀 Beyond the Basics

Full method index and suggested reading order.

Example 6 — Wrapper prototype method index

Each method has a dedicated tutorial under /lodash/seq/prototype/{method}.

MethodWhat it does
.value()Execute the chain and return the unwrapped plain result (alias of valueOf).
.commit()Run pending chain actions eagerly and return the wrapper for further chaining.
.plant()Create a clone of the chain at the same pipeline stage with a new wrapped value.
.next()Advance lazy iteration on wrapped sequences (iterator protocol).
.reverse()Reverse the wrapped array in place inside the chain.
.at()Apply a function at a specific index or path within the chain context.
.chain()Enable explicit chaining on the wrapper (re-wrap the current value).

Suggested order for beginners: .value().commit().plant() → advanced helpers.

🧠 How Wrapper Prototype Methods Work

1

Start a wrapper

_(value) or _.chain(value) returns a sequence wrapper with queued chain steps.

Wrap
2

Queue transforms

Collection methods (map, filter, etc.) add steps; the wrapper still holds deferred work until unwrap.

Pipeline
3

Control with prototype

Call .value() to finish, .commit() to run eagerly and continue, or .plant() to clone the chain.

Prototype
=

Plain result or next wrapper

Most code ends with .value(). Advanced flows use .commit() or .plant() before more steps.

📝 Notes

  • There is no _.prototype() function—prototype methods are called on the wrapper (.value(), not _.value()).
  • .value() and .valueOf() are aliases—both unwrap the chain.
  • .commit() is rarely needed in everyday code; reach for it when mixing wrapper and plain Lodash in one pipeline.
  • .reverse() mutates the wrapped array in place, like native Array.prototype.reverse.
  • .next() is for iterator-style lazy sequences—most beginners only need .value().
  • Deep dives live at /lodash/seq/prototype/value, .../commit, etc.

Conclusion

Wrapper prototype methods are how you steer a Lodash chain: unwrap with .value(), run eagerly with .commit(), clone with .plant(), or handle advanced iteration with .next() and .reverse().

Start with .value()—it covers 95% of real projects. Next in the series: Lodash Wrapper _.at().

💡 Best Practices

✅ Do

  • Default to .value() at the end of every chain in application code
  • Learn .commit() only when you hit hybrid chaining scenarios
  • Use .plant() to reuse a pipeline template across datasets
  • Read individual tutorials for .next() and .reverse() before using them
  • Annotate TypeScript types after .value(), not on the wrapper

❌ Don’t

  • Search for or call a non-existent _.prototype() function
  • Assume .value() and .commit() are interchangeable
  • Use .reverse() when you need a non-mutating copy
  • Skip .value() and pass wrappers to functions expecting plain arrays
  • Overuse advanced prototype methods when a simple chain + unwrap suffices

Key Takeaways

Knowledge Unlocked

Five things to remember about wrapper prototype

Use these when finishing or controlling Lodash chains.

5
Core concepts
⚙️ 02

.commit() hybrid

Run + re-chain.

Advanced
🔄 03

.plant() clone

New wrapped value.

Pattern
📈 04

Not _.prototype()

Methods on wrapper.

Fix myth
🛠️ 05

Deep dives

/prototype/value...

Next steps

❓ Frequently Asked Questions

It is the set of methods on the sequence wrapper returned by _(value) or _.chain(value)—not a separate _.prototype() function. These methods control unwrapping, eager execution, cloning, and iteration.
.value() (or .valueOf()) unwraps the chain and returns plain JavaScript data. Always call it when you need the final array, object, or number in application code.
Use .commit() when you want to run pending chain steps eagerly but keep chaining on the wrapper—for hybrid pipelines that mix wrapper and plain Lodash calls.
.plant() creates a new wrapper clone at the same pipeline stage but swaps in a different wrapped value, useful for reusing a chain template on new data.
.next() advances lazy iterator-style sequences on the wrapper (Symbol.iterator protocol). .map() is a standard transform that returns another wrapper with a map step queued.
Yes. .reverse() reverses the wrapped array in place inside the chain, similar to Array.prototype.reverse. Clone first if you need to preserve the original order.
Did you know?

There is no standalone _.prototype() function in Lodash. Wrapper prototype refers to methods like .value(), .commit(), and .plant() on the object returned by _(value) or _.chain(value).

Practice Wrapper Prototype in the Live Editor

Unwrap with .value(), try .commit() hybrid chains, and clone pipelines with .plant().

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