Lodash _.prototype.plant() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Seq

Definition

Creates a clone of the chain sequence, planting a new value as the wrapped value. Queued actions (like .map) stay; only the starting data changes. Call it on a Lodash wrapper from _(value) or _.chain(value). Part of Lodash Seq (since 3.2.0).

Call it on a Lodash wrapper. Finish with .value() when you need a plain result.

Syntax

Call _.prototype.plant(). Start with this line.

Lodash
wrapper.plant(value)
CallWhat it does
wrapper.plant(value)Primary signature.

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

Library declarations
Lodash
wrapper.plant(value)

Parameters

ParameterDescription
ReceiverRequired. A Lodash wrapper with queued actions
valueRequired. New data to plant as the wrapped value

Return Value

Return ValueDescription
*New wrapper (clone of the chain)

Lodash Examples

Example 1 — Official plant

Reuse map(square) on a new array.

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

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

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

How It Works

  1. Build. Queue map(square) on [1, 2].
  2. Plant. Clone that pipeline onto [3, 4].
  3. Unwrap. other.value() squares each planted number.
  4. Docs. Matches the official Lodash example.

Example 2 — Original Stays Independent

Planting does not change the first wrapper’s result.

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

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

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

How It Works

  1. Clone. other is a separate wrapper.
  2. Planted. Runs on [3, 4] → [9, 16].
  3. Original. Still rooted at [1, 2] → [1, 4].
  4. Rule. Safe to plant without fear of mutating the template chain.

Example 3 — Plant a Filter Pipeline

Reuse more than one queued step.

Lodash
var pipeline = _([1, 2, 3, 4])
  .filter(function (n) { return n % 2 === 0; })
  .map(function (n) { return n * 10; });

var other = pipeline.plant([5, 6, 7, 8]);

other.value();
// → [60, 80]
Try It Yourself

How It Works

  1. Queue. Keep even numbers, then multiply by 10.
  2. Plant. Replay on [5, 6, 7, 8].
  3. Filter. Evens → 6, 8.
  4. Map. 60, 80.

Example 4 — plant vs New Chain

Same result; plant reuses the built pipeline.

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

var wrapped = _([1, 2]).map(square);

[
  wrapped.plant([3, 4]).value(),
  _([3, 4]).map(square).value()
];
// → [[9, 16], [9, 16]]
Try It Yourself

How It Works

  1. plant. Clones the existing map(square) queue.
  2. Fresh chain. Rebuilds the same steps from scratch.
  3. Result. Both yield [9, 16].
  4. When. Prefer plant when the pipeline is already built and complex.

Example 5 — Plant, Then Continue

The planted result is still a wrapper — keep chaining.

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

var wrapped = _([1, 2]).map(square);

wrapped.plant([3, 4]).reverse().value();
// → [16, 9]
Try It Yourself

How It Works

  1. Plant. Starts from [3, 4] with map(square).
  2. Continue. .reverse() flips the squared list.
  3. Unwrap. .value() → [16, 9].
  4. Note. Extra steps after plant apply only to that clone.

Browser & Runtime Support

Wrapper .plant() is a Lodash Seq prototype method (since 3.2.0). It needs no special browser APIs beyond loading Lodash.

✓ Stable · Lodash 3.2.0+

_.prototype.plant()

Available in [email protected] full builds when using _(value) / _.chain(value). Works in evergreen browsers and Node / Bun / Deno when Lodash is installed.

100% With Lodash 3.2.0+
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
.plant() Lodash 3.2.0+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer the full lodash build for Seq / wrapper APIs.

Frequently Asked Questions

It creates a clone of the chain sequence with a new wrapped value. Official docs: _( [1,2] ).map(square).plant([3,4]).value() → [9,16] while the original wrapper still yields [1,4].
No. It returns a new wrapper. The original chain and its value stay independent.
A single value — the new data to plant as the wrapped value. Existing queued actions (map, filter, …) apply to that value when you unwrap.
No. It returns another Lodash wrapper. Call .value() (or keep chaining) to get plain JavaScript data.
When you already built a transform pipeline and want to replay it on different inputs without rewriting the chain.
No. Call it on a wrapper from _(value) or _.chain(value). Docs list it as _.prototype.plant().

Next: .reverse()

Reverse the wrapped array inside a Lodash chain.

.reverse() tutorial →

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