Like _.tap, except it returns the result of interceptor. Use it to “pass thru” and replace intermediate values in a chain. Part of Lodash Seq (since 3.0.0).
Pass the value you want to wrap or transform. Finish with .value() when the result stays wrapped.
Syntax
Call _.thru. Start with this line.
Lodash
_.thru(value, interceptor)
Call
What it does
_.thru(value, interceptor)
Primary signature.
_.thru(value)
Wrap or control a Lodash sequence.
Prefer import thru from "lodash/thru" when you want a smaller bundle.
Library declarations
Lodash
_.thru(value, interceptor)
Parameters
Parameter
Description
value
Required. Passed to the interceptor
interceptor
Required. Called as interceptor(value); its return becomes the result
Return Value
Return Value
Description
*
Whatever the interceptor returns
Lodash Examples
Example 1 — Official Trim → Array
Replace a trimmed string with a one-element array.
Return. That filtered array replaces the previous list.
Note. You could use .filter directly here; thru shines for less standard shapes.
Compatibility
Browser & Runtime Support
_.thru is a Lodash Seq method (since 3.0.0). It needs no special browser APIs beyond loading Lodash.
✓ Stable · Lodash 3.0.0+
_.thru()
Available in [email protected] full builds and modular builds that include Seq helpers. Works in evergreen browsers and Node / Bun / Deno when Lodash is installed.
100%With Lodash 3.0.0+
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
_.thruLodash 3.0.0+
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer the full lodash build for Seq chaining.
Frequently Asked Questions
_.thru(value, interceptor) returns the result of interceptor(value). Official docs: like _.tap except it returns the interceptor result, replacing intermediate chain values.
_(' abc ').chain().trim().thru(value => [value]).value() → ['abc']. Trim first, then wrap the string in an array.
tap always returns the original value (interceptor return ignored). thru returns whatever the interceptor returns.
When you need a custom transform that Lodash does not provide as a chain method — for example wrapping a string in an array mid-pipeline.
Yes. _.thru(value, fn) works standalone and simply returns fn(value).
The official example uses .chain() so later steps stay wrapped. In hybrid mode, some returns may unwrap early — use .chain() when you need explicit chaining.