Lodash _.overArgs() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

Creates a function that invokes func with its arguments transformed by matching transform functions — one adapter per parameter slot. Part of Lodash 4.x Function (since 4.0.0).

Pass the required arguments shown below. Most helpers return a new function you call later.

Syntax

Call _.overArgs. Start with this line.

Lodash
_.overArgs(func, [transforms=[_.identity]])
CallWhat it does
_.overArgs(func, [transforms=[_.identity]])Primary signature.
_.overArgs(func)Wrap or transform a function.

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

Library declarations
Lodash
_.overArgs(func, [transforms=[_.identity]])

Parameters

ParameterDescription
funcRequired. Function invoked with transformed args
transformsOptional. Array of unary adapters; default identity

Return Value

Return ValueDescription
*New wrapper function

Lodash Examples

Example 1 — Official: Square + Double

Transform each argument before packing them into an array.

Lodash
function doubled(n) {
  return n * 2;
}

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

var func = _.overArgs(function (x, y) {
  return [x, y];
}, [square, doubled]);

func(9, 3);
// → [81, 6]
Try It Yourself

How It Works

  1. Transforms. Index 0 uses square; index 1 uses doubled.
  2. 9. Becomes 81.
  3. 3. Becomes 6.
  4. func. Receives (81, 6) and returns [81, 6].

Example 2 — Official: Another Pair

Same wrapper, different inputs — adapters stay the same.

Lodash
function doubled(n) {
  return n * 2;
}

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

var func = _.overArgs(function (x, y) {
  return [x, y];
}, [square, doubled]);

func(10, 5);
// → [100, 10]
Try It Yourself

How It Works

  1. Reuse. Same func wrapper as example 1.
  2. 10. Squared → 100.
  3. 5. Doubled → 10.
  4. Result. [100, 10].

Example 3 — Coerce String Arguments to Numbers

Useful when APIs pass strings but your function wants numbers.

Lodash
var add = _.overArgs(
  function (a, b) {
    return a + b;
  },
  [Number, Number]
);

add("2", "3");
// → 5

add("2", "3") === "2" + "3";
// → false   // without overArgs, strings would concatenate
Try It Yourself

How It Works

  1. Adapters. Both slots use Number.
  2. "2" → 2; "3" → 3.
  3. Add. Numeric addition yields 5.
  4. Without. Raw "2" + "3" would be "23".

Example 4 — Trim and Uppercase

Clean user input before a greeting function sees it.

Lodash
var greet = _.overArgs(
  function (first, last) {
    return first + " " + last;
  },
  [
    function (s) { return _.trim(s).toUpperCase(); },
    function (s) { return _.trim(s).toUpperCase(); }
  ]
);

greet("  ada ", " lovelace ");
// → "ADA LOVELACE"
Try It Yourself

How It Works

  1. Each slot. Trim whitespace, then uppercase.
  2. first. " ada " → "ADA".
  3. last. " lovelace " → "LOVELACE".
  4. Join. Greeting function just concatenates clean values.

Example 5 — Extra Arguments Pass Through

When transforms are shorter than the call, leftover args are unchanged.

Lodash
var pack = _.overArgs(
  function (a, b, c) {
    return [a, b, c];
  },
  [function (n) { return n * 10; }]
);

pack(2, 3, 4);
// → [20, 3, 4]
Try It Yourself

How It Works

  1. One transform. Only index 0 is adapted.
  2. 2. Becomes 20.
  3. 3 and 4. No adapters → passed as-is.
  4. Tip. Use _.identity explicitly for slots you want to document as unchanged.

Browser & Runtime Support

_.overArgs is a Lodash 4.x Function helper (since 4.0.0; formerly _.modArgs). It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash. There is no single native Function.overArgs.

✓ Stable · Lodash 4.x

_.overArgs()

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

Bottom line: Safe for production once Lodash is loaded. Prefer import overArgs from "lodash/overArgs" for smaller builds. Ideal for coercing, cleaning, or normalizing arguments before a core function runs.

Frequently Asked Questions

_.overArgs(func, transforms) returns a wrapper that maps each argument through the transform at the same index, then calls func with those mapped values.
Yes. Lodash treats each transform as unary — it receives only the matching argument value.
Extra arguments past the transforms list are still passed through to func unchanged.
rearg reorders arguments. overArgs transforms values in place by position — it does not swap slots.
ary/unary cap how many arguments reach func. overArgs keeps arity but adapts each slot’s value first.
Use import overArgs from "lodash/overArgs" or require("lodash/overArgs") for tree-shaking. Full build: import _ from "lodash" then _.overArgs.

Next: _.partial()

Create a function with some arguments pre-filled from the left.

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