lodash.isobject

raw JSON →
3.0.2 verified Sat Apr 25 auth: no javascript deprecated

A standalone module exporting lodash's _.isObject function (v3.0.2). Checks if a value is a language type of 'object', excluding null. This modularized lodash package is part of the v3 series and is considered legacy; it is recommended to use the full lodash 4.x+ or lodash-es packages instead. The package is deprecated and no longer maintained, with no new releases planned. Version 3.0.2 is the latest and final release.

error Error: Cannot find module 'lodash.isobject'
cause The package is not installed or the name is misspelled (e.g., 'lodash.isObject' with capital 'O').
fix
Run 'npm install lodash.isobject' and require exactly 'lodash.isobject' (lowercase).
error SyntaxError: Cannot use import statement outside a module
cause Attempting to use ES module import syntax on a CommonJS-only package.
fix
Use require('lodash.isobject') or switch to lodash-es if you need ESM.
error undefined is not a function
cause Trying to destructure the require result (e.g., const { isObject } = require('lodash.isobject')).
fix
Use 'const isObject = require('lodash.isobject')' directly.
deprecated This package is part of lodash v3 modular builds and is no longer maintained. Use lodash 4.x+ (full) or lodash-es instead.
fix Replace with lodash 4.x: npm install lodash and use _.isObject.
gotcha In lodash v3, isObject returns true for functions, while some users expect it to only return true for plain objects. This behavior is consistent with the language type 'object' in JavaScript (which includes functions).
fix Use isObjectLike or isPlainObject if you want to exclude functions.
gotcha The package name is 'lodash.isobject' (all lowercase), though the documentation may refer to 'isObject'. Installation must use the lowercase name.
fix Use npm install lodash.isobject (lowercase).
breaking lodash v4 changed the behavior of many functions. isObject is largely the same but the overall API is different. This package is frozen at v3 behavior.
fix If you need v4 behavior, use 'lodash' package directly.
npm install lodash.isobject
yarn add lodash.isobject
pnpm add lodash.isobject

Demonstrates using require() to import the module and testing various values with isObject().

var isObject = require('lodash.isobject');
console.log(isObject({})); // true
console.log(isObject([1, 2, 3])); // true
console.log(isObject(null)); // false
console.log(isObject(42)); // false
console.log(isObject('string')); // false
console.log(isObject(undefined)); // false
console.log(isObject(function() {})); // true (functions are objects)
console.log(isObject(/regex/)); // true