Like _.assignIn, but accepts a customizer to produce each assigned value. If the customizer returns undefined, assignment is handled normally. Alias: _.extendWith. Part of Lodash Object since 4.0.0 (stable — not deprecated).
Pass the object and path or keys shown below. Check whether the helper mutates or returns a new object.
Syntax
Call _.assignInWith. Start with this line.
Lodash
_.assignInWith(object, ...sources, customizer)
Call
What it does
_.assignInWith(object, ...sources, customizer)
Primary signature.
_.assignInWith(object)
Work with an object’s keys, values, or paths.
Prefer import assignInWith from "lodash/assignInWith" when you want a smaller bundle.
Library declarations
Lodash
_.assignInWith(object, ...sources, customizer)
Parameters
Parameter
Description
object
Required. Destination (mutated and returned)
...sources
Optional. Own + inherited enumerable string keys
customizer
Required. Last argument — produces assigned values
Return Value
Return Value
Description
*
The value returned by _.assignInWith().
Lodash Examples
Example 1 — Official: Defaults-Style Customizer
Keep existing values; only fill keys that are still undefined.
Own key. Source a: 1 does not overwrite destination a: 9.
Inherited. Prototype b: 2 is still a candidate key.
Fill.b was undefined on the destination → assigned.
assignWith. Skips inherited b entirely.
Compatibility
Browser & Runtime Support
_.assignInWith is a Lodash Object helper (available since 4.0.0, stable in 4.x; alias _.extendWith). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 4.0.0+
_.assignInWith()
Available in [email protected] full builds and the lodash/assignInWith modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.assignInWithLodash 4.0.0+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import assignInWith from "lodash/assignInWith" for smaller builds. Use _.assignWith when you only need own keys.
Frequently Asked Questions
_.assignInWith(object, ...sources, customizer) is like _.assignIn, but each assigned value can be produced by your customizer. If the customizer returns undefined, Lodash assigns the source value as usual.
Yes. _.extendWith is the documented alias of _.assignInWith.
Five arguments: (objValue, srcValue, key, object, source).
Same customizer idea. _.assignInWith walks own and inherited enumerable string keys; _.assignWith walks own keys only.
Yes. Use _.assignInWith({}, ...sources, customizer) when you want a new object.
Use import assignInWith from "lodash/assignInWith" or require("lodash/assignInWith"). Full build: import _ from "lodash" then _.assignInWith or _.extendWith.