Creates an array of the own and inherited enumerable property names of object. Part of Lodash Object since 3.0.0 (stable — not deprecated). Non-object values are coerced to objects.
Note: Official docs say iteration order is not guaranteed. Only enumerable inherited keys appear — ES class methods usually do not.
Syntax
Call _.keysIn. Start with this line.
Lodash
_.keysIn(object)
Call
What it does
_.keysIn(object)
Primary signature.
Prefer import keysIn from "lodash/keysIn" when you want a smaller bundle.
Library declarations
Lodash
_.keysIn(object)
Parameters
Parameter
Description
object
Required. Object to query (non-objects are coerced)
Return Value
Return Value
Description
*
Array of own + inherited enumerable names
Lodash Examples
Example 1 — Official: Own + Inherited
Prototype properties that are enumerable are included.
Same idea. Matches how _.keys('hi') behaves for own indexes.
Compatibility
Browser & Runtime Support
_.keysIn is a Lodash Object helper since 3.0.0. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.
✓ Stable · Lodash 3.0.0+
_.keysIn()
Available in [email protected] full builds and the lodash/keysIn modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 3+
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
_.keysInLodash 3.0.0+
Bottom line: Safe for production once Lodash is loaded. Prefer import keysIn from "lodash/keysIn" for smaller bundles. Use it when inherited enumerable keys must be visible.
Frequently Asked Questions
_.keysIn(object) creates an array of the own and inherited enumerable property names of object. Official: _.keysIn(new Foo) → ['a', 'b', 'c'] when Foo.prototype.c is enumerable.
_.keys returns only own enumerable string keys. _.keysIn also includes inherited enumerable string keys from the prototype chain.
Usually no. Class methods on the prototype are non-enumerable. Older Foo.prototype.method = fn assignments are enumerable by default, so those do appear.
No. It returns string-keyed property names only.
Yes. _.keysIn(null) and _.keysIn(undefined) return [] instead of throwing.
Use import keysIn from "lodash/keysIn" or require("lodash/keysIn") for tree-shaking. Full build: import _ from "lodash" then _.keysIn.