Lodash _.partialRight() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

Like _.partial, but partially applied arguments are appended after the ones you pass later. Freeze trailing parameters while leaving leading slots open. Part of Lodash 4.x Function.

Note: This method doesn’t set the length property of partially applied functions.

Syntax

Call _.partialRight. Start with this line.

Lodash
_.partialRight(func, [partials])
CallWhat it does
_.partialRight(func, [partials])Primary signature.
_.partialRight(func)Wrap or transform a function.

Prefer import partialRight from "lodash/partialRight" when you want a smaller bundle.

Library declarations
Lodash
_.partialRight(func, [partials])

Parameters

ParameterDescription
funcRequired. Function to wrap
partialsOptional. Trailing values (and optional placeholders)

Return Value

Return ValueDescription
*New partially applied function

Lodash Examples

Example 1 — Official: Freeze the Trailing Name

Supply the greeting later; keep the name fixed.

Lodash
function greet(greeting, name) {
  return greeting + " " + name;
}

var greetFred = _.partialRight(greet, "fred");
greetFred("hi");
// → "hi fred"
Try It Yourself

How It Works

  1. Target. greet needs greeting then name.
  2. Partial. "fred" is appended as the trailing argument.
  3. Call. greetFred("hi") supplies only the greeting.
  4. Merge. Runs greet("hi", "fred").

Example 2 — Official: Placeholder Slot

Leave a trailing slot open with _ (full build placeholder).

Lodash
function greet(greeting, name) {
  return greeting + " " + name;
}

var sayHelloTo = _.partialRight(greet, "hello", _);
sayHelloTo("fred");
// → "hello fred"
Try It Yourself

How It Works

  1. Partials. Trailing list is "hello" and a placeholder.
  2. Fill. "fred" replaces _ among the partials.
  3. Result. greet("hello", "fred").
  4. Modular. Prefer partialRight.placeholder with lodash/partialRight.

Example 3 — Fix the Denominator

Pass the numerator at call time; keep the divisor constant.

Lodash
function divide(a, b) {
  return a / b;
}

var overTen = _.partialRight(divide, 10);
overTen(55);
// → 5.5
Try It Yourself

How It Works

  1. Freeze. Second parameter b is always 10.
  2. Call. overTen(55) supplies a.
  3. Run. divide(55, 10) → 5.5.
  4. Use. Handy for config values that belong at the end of an API.

Example 4 — _.partialRight vs _.partial

Same values, opposite merge directions.

Lodash
function pair(a, b) {
  return [a, b];
}

_.partialRight(pair, "right")("left");
// → ["left", "right"]

_.partial(pair, "left")("right");
// → ["left", "right"]
Try It Yourself

How It Works

  1. Right. partialRight appends "right"; call supplies "left".
  2. Left. partial prepends "left"; call supplies "right".
  3. Same pair. Both end up as ["left", "right"].
  4. Pick by API. Freeze the end you control; leave the dynamic end open.

Example 5 — Two Trailing Segments

Anchor more than one suffix value at once.

Lodash
function joinTriple(a, b, c) {
  return a + "." + b + "." + c;
}

var localeBundle = _.partialRight(joinTriple, "en", "json");
localeBundle("messages");
// → "messages.en.json"
Try It Yourself

How It Works

  1. Partials. Trailing "en" and "json" are fixed.
  2. Call. Only the basename "messages" is supplied.
  3. Merge. joinTriple("messages", "en", "json").
  4. Use. Shared suffixes for files, locales, or route builders.

Browser & Runtime Support

_.partialRight is a long-standing Lodash 4.x Function helper. It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 4.x

_.partialRight()

Available in [email protected] full builds and the lodash/partialRight modular import. 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
_.partialRight Lodash 4.x

Bottom line: Safe for production once Lodash 4.x is on the page or in your bundle. Prefer import partialRight from "lodash/partialRight" for smaller builds. For leading arguments, use _.partial.

Frequently Asked Questions

_.partialRight(func, ...partials) returns a new function that invokes func with your partials appended after the arguments supplied at call time — so trailing parameters stay fixed.
_.partial prepends fixed values before caller arguments. _.partialRight appends them afterward. Choose based on which end of the parameter list you want to freeze.
A sentinel (defaults to _ in the full Lodash build) that marks a slot among the trailing partials to fill later from the call-site arguments.
No. It only handles argument partial application. Use _.bind when you need a fixed this.
No. Lodash notes that this method doesn't set the length property of partially applied functions — don't rely on wrapper.length for arity.
Use import partialRight from "lodash/partialRight" then partialRight.placeholder for deferred slots. Full build: import _ from "lodash" then _.partialRight.

Next: _.rearg()

Create a function that invokes another with arguments rearranged by index.

_.rearg() 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.

10 people found this page helpful