Pick. Prefer stubs for booleans; constant for any value.
Compatibility
Browser & Runtime Support
_.stubTrue is a Lodash Util helper since 4.13.0. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash (4.13+).
✓ Stable · Lodash 4.13.0+
_.stubTrue()
Available in [email protected]+ full builds and the lodash/stubTrue modular import. Works in evergreen browsers and current Node LTS when a recent Lodash is installed.
100%With Lodash 4.13+
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
_.stubTrueLodash 4.13.0+
Bottom line: Safe for production on Lodash 4.13+. Prefer import stubTrue from "lodash/stubTrue" for smaller bundles. Use it for default cond branches and simple always-true iteratees.
Frequently Asked Questions
_.stubTrue() is a function that always returns true. Official example: _.times(2, _.stubTrue) → [true, true].
It is a shared, named stub from Lodash—handy as a default predicate in _.cond, or as an iteratee for _.times, without writing a new arrow each time.
Yes. Any arguments are ignored; the return value is always true.
Both return true. _.constant(true) is a factory for any fixed value; _.stubTrue is a ready-made always-true function with no setup.
As the last pair’s predicate: [_.stubTrue, handler] acts like else / default because stubTrue is always truthy.
Use import stubTrue from "lodash/stubTrue" or require("lodash/stubTrue"). Full build: import _ from "lodash" then _.stubTrue.