Adds all own enumerable string-keyed function properties of source to the destination object (defaults to Lodash). If the destination is a function, methods are added to its prototype as well. Part of Lodash Util since 0.1.0 (stable — not deprecated).
Pass the arguments shown below. Prefer modular imports when you only need this helper.
Syntax
Call _.mixin. Start with this line.
Lodash
_.mixin([object=lodash], source, [options={}])
Call
What it does
_.mixin([object=lodash], source, [options={}])
Primary signature.
_.mixin(...)
Call the util helper.
Prefer import mixin from "lodash/mixin" when you want a smaller bundle.
Library declarations
Lodash
_.mixin([object=lodash], source, [options={}])
Parameters
Parameter
Description
object
Optional. Destination (default: Lodash). Functions also get prototype methods.
source
Required. Object whose own function properties are copied
options.chain
Optional. Default true — keep mixins chainable
Return Value
Return Value
Description
*
The destination object
Lodash Examples
Example 1 — Official: vowels Mixin
Add a custom helper and call it directly or through a chain.
Fresh copy._.runInContext() returns a private Lodash.
Mixin there.double lives only on that copy.
Call.lodash.double(21) → 42.
Safe. Global _ has no double — avoids plugin clashes.
Compatibility
Browser & Runtime Support
_.mixin is a Lodash Util helper since 0.1.0. It runs anywhere the full Lodash build runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 0.1.0+
_.mixin()
Available in [email protected] full builds. Modular per-method imports do not include mixin alone — use the full build or a custom Lodash build when you need it.
100%With Lodash 0.1+
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
_.mixinLodash 0.1.0+
Bottom line: Safe for production once the full Lodash build is loaded. Prefer _.runInContext() before mixing in shared or library code.
Frequently Asked Questions
_.mixin([object=lodash], source, [options]) copies every own enumerable string-keyed function from source onto object. By default object is Lodash itself, so helpers become _.yourFn() and can join chains when options.chain is true.
When chain is true (default), mixed-in methods stay wrapped in Lodash chains so you can call .value(). When chain is false, a chained call returns the raw result immediately.
Yes. Pass the destination first: _.mixin(myUtils, { greet(name) { return 'Hi ' + name; } }). Returns the same object. Global _ is not changed.
Mixing into the shared _ can clash with other code or overwrite built-ins. _.runInContext() gives a fresh Lodash copy you can extend safely.
No. Only own enumerable function properties on source are added. Nested non-function values are skipped.
No. It is a stable Lodash Util method since 0.1.0. Prefer modules for most apps; use mixin when you want Lodash-style extensions or chaining.