Checks if path is a direct or inherited property of object. Part of Lodash Object (stable — not deprecated). Like a normal property lookup: prototype-chain keys count. For own-only checks, use _.has.
Pass the object and path or keys shown below. Check whether the helper mutates or returns a new object.
Syntax
Call _.hasIn. Start with this line.
Lodash
_.hasIn(object, path)
Call
What it does
_.hasIn(object, path)
Primary signature.
_.hasIn(object)
Work with an object’s keys, values, or paths.
Prefer import hasIn from "lodash/hasIn" when you want a smaller bundle.
Difference. Appears only when inheritance is involved.
Rule. Start with has; switch to hasIn when prototypes matter.
Compatibility
Browser & Runtime Support
_.hasIn is a Lodash Object helper available in 4.x (and earlier builds). It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native key in object covers a single key including inheritance; Lodash adds nested path support.
✓ Stable · Lodash 4.x
_.hasIn()
Available in [email protected] full builds and the lodash/hasIn 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
_.hasInLodash 4.x
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import hasIn from "lodash/hasIn" for smaller builds. Use _.has when only own properties should count.
Frequently Asked Questions
_.hasIn(object, path) checks if path is a direct or inherited property of object. Official: with _.create, _.hasIn(object, 'a.b') → true even though the path is inherited.
_.has only counts own properties. _.hasIn also counts properties found on the prototype chain.
No. Existence is not truthiness. A path whose value is undefined, null, false, 0, or '' still returns true.
Dotted strings like 'a.b' or array paths like ['a', 'b']. Prefer arrays when a key literally contains dots.
Yes. Methods live on the prototype, so _.hasIn(instance, 'methodName') is typically true while _.has is false.
Use import hasIn from "lodash/hasIn" or require("lodash/hasIn") so bundlers can tree-shake. Full build: import _ from "lodash" then _.hasIn.