Lodash Wrapper prototype

Beginner
5 min read
Updated: Nov 2026
5 examples
Seq

Definition

Methods on the Lodash sequence wrapper returned by _(value) or _.chain(value). They steer the pipeline: unwrap, commit, clone, reverse, or iterate. Part of Lodash 4.x Seq.

Pass the value you want to wrap or transform. Finish with .value() when the result stays wrapped.

Syntax

Use wrapper prototype methods. Start with this line.

Lodash
wrapper.value() / .commit() / .plant(value)
CallWhat it does
wrapper.value() / .commit() / .plant(value)Primary signature.
wrapper.value()Wrap or control a Lodash sequence.

Prefer import _ from "lodash" (full build) when you need wrapper prototype helpers.

Library declarations
Lodash
wrapper.value() / .commit() / .plant(value)

Parameters

ParameterDescription
WrapperRequired. From _() or _.chain()
Collection stepsOptional. Queue transforms

Return Value

Return ValueDescription
*The value returned by Wrapper prototype.

Lodash Examples

Example 1 — Unwrap with .value()

Finish a chain and get a plain array.

Lodash
_([1, 2, 3, 4, 5])
  .map(function (x) { return x * 2; })
  .filter(function (x) { return x > 5; })
  .value();
// → [6, 8, 10]
Try It Yourself

How It Works

  1. Wrap. _([1…5]) starts an implicit sequence.
  2. map. Doubles each number — still wrapped.
  3. filter. Keeps values > 5 — still wrapped.
  4. value. Executes the chain and returns a plain array.

Example 2 — .valueOf() alias

Same unwrap as .value().

Lodash
var a = _([1, 2, 3]).map(function (n) { return n + 1; }).value();
var b = _([1, 2, 3]).map(function (n) { return n + 1; }).valueOf();

JSON.stringify(a) === JSON.stringify(b);
// → true
// a and b are both [2, 3, 4]
Try It Yourself

How It Works

  1. Official. .valueOf is an alias of .value.
  2. Both. Run the same map pipeline.
  3. Compare. Results match.
  4. Prefer. Use .value() in everyday code for clarity.

Example 3 — .commit() hybrid

Run pending steps eagerly, then keep chaining.

Lodash
_([1, 2, 3, 4, 5])
  .map(function (x) { return x * 2; })
  .commit()
  .filter(function (x) { return x > 5; })
  .value();
// → [6, 8, 10]
Try It Yourself

How It Works

  1. map. Queues a double step.
  2. commit. Runs it now; returns a wrapper (not plain data).
  3. filter. Continues on that wrapper.
  4. value. Final unwrap. Use when mixing eager + more chain steps.

Example 4 — .plant() clone

Reuse the same pipeline on different data (official-style).

Lodash
function square(n) { return n * n; }

var wrapped = _([1, 2]).map(square);
var other = wrapped.plant([3, 4]);

other.value();
// → [9, 16]

wrapped.value();
// → [1, 4]
Try It Yourself

How It Works

  1. Template. wrapped queues map(square) on [1, 2].
  2. plant. Clones that chain with [3, 4].
  3. other.value. Squares the planted array → [9, 16].
  4. wrapped.value. Original pipeline still works → [1, 4].

Example 5 — .reverse() mutates

Reverses the wrapped array in place (official).

Lodash
var array = [1, 2, 3];

_(array).reverse().value();
// → [3, 2, 1]

array;
// → [3, 2, 1]   // mutated
Try It Yourself

How It Works

  1. Wrap. Same array reference inside the wrapper.
  2. reverse. Reverses in place (like native Array#reverse).
  3. value. Returns the reversed array.
  4. Pitfall. array itself is also reversed — clone first if you need the original.

Browser & Runtime Support

Wrapper prototype methods ship with Lodash 4.x Seq. They run anywhere full Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. There is no native Lodash wrapper — use nested calls or array methods instead.

✓ Stable · Lodash 4.x

Wrapper prototype

Available on wrappers from _(value) / _.chain in [email protected] full builds. Not typical of tiny modular lodash/* imports. 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
.value / .commit / .plant Lodash 4.x full

Bottom line: Safe for production with full Lodash. Default to .value(); use commit/plant for advanced control.

Frequently Asked Questions

Methods on the sequence wrapper from _(value) or _.chain(value)—not a _.prototype() function. They unwrap, commit, clone, or iterate the chain.
.value() (alias .valueOf()) executes the chain and returns plain JavaScript data. Use it when you need the final array, object, or number.
When you want pending steps to run eagerly but keep chaining on the wrapper (hybrid pipelines).
It clones the chain at the same pipeline stage with a different wrapped value—reuse a template on new data.
Yes. Like Array.prototype.reverse, it reverses the wrapped array in place. Clone first if you need the original order.
No. Call methods on the wrapper: _(arr).map(fn).value(), not _.prototype().

Next: Wrapper .at()

Pluck values at one or more paths inside a Lodash chain.

Wrapper .at() →

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