Creates a function that invokes the method at object[key] with partials prepended to the arguments it receives. Part of Lodash 4.x Function (since 0.10.0).
Pass the required arguments shown below. Most helpers return a new function you call later.
Syntax
Call _.bindKey. Start with this line.
Lodash
_.bindKey(object, key, …partials)
Call
What it does
_.bindKey(object, key, …partials)
Primary signature.
_.bindKey(func)
Wrap or transform a function.
Prefer import bindKey from "lodash/bindKey" when you want a smaller bundle.
Lookup. First call finds the new method and runs it.
Caution. Calling before the method exists throws (not a function).
Compatibility
Browser & Runtime Support
_.bindKey is a Lodash 4.x Function helper (since 0.10.0). It needs no special browser APIs beyond loading Lodash.
✓ Stable · Lodash 0.10.0+
_.bindKey()
Available in [email protected] full builds and the lodash/bindKey modular import. Works in evergreen browsers and Node / Bun / Deno 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
_.bindKeyLodash 4.x+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import bindKey from "lodash/bindKey" for smaller builds.
Frequently Asked Questions
_.bindKey(object, key, ...partials) returns a function that looks up object[key] each time it runs, calls that method with this set to object, and prepends any partials.
bind captures a specific function value when you create the wrapper. bindKey stores the object and key, so replacing object[key] later changes what the wrapper calls.
A sentinel (often _ in the full Lodash build) marking argument slots to fill at call time. In modular imports use bindKey.placeholder.
That is a main use case — create the bound function early, then define or swap object[key] before the first call.
No. It only reads object[key] on each invocation and returns a new wrapper function.
Use import bindKey from "lodash/bindKey" then bindKey.placeholder for deferred slots. Full build: import _ from "lodash" then _.bindKey.