or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-lodash--isobject

The modern build of lodash's `_.isObject` as a module.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/lodash.isobject@3.0.x

To install, run

npx @tessl/cli install tessl/npm-lodash--isobject@3.0.0

index.mddocs/

lodash.isobject

A standalone implementation of lodash's _.isObject utility function that checks if a value is the ECMAScript language type of Object. This modular build provides a lightweight, zero-dependency alternative to importing the entire lodash library when only the isObject functionality is needed.

Package Information

  • Package Name: lodash.isobject
  • Package Type: npm
  • Language: JavaScript
  • Installation: npm install lodash.isobject

Core Imports

const isObject = require('lodash.isobject');

Basic Usage

const isObject = require('lodash.isobject');

// Objects return true
console.log(isObject({}));           // => true
console.log(isObject({ a: 1 }));     // => true

// Arrays are objects
console.log(isObject([1, 2, 3]));    // => true
console.log(isObject([]));           // => true

// Functions are objects
console.log(isObject(function() {})); // => true
console.log(isObject(() => {}));      // => true

// Regular expressions are objects
console.log(isObject(/abc/));         // => true

// Boxed primitives are objects
console.log(isObject(new Number(5))); // => true
console.log(isObject(new String(''))); // => true

// Primitives and null return false
console.log(isObject(null));          // => false
console.log(isObject(undefined));     // => false
console.log(isObject('string'));      // => false
console.log(isObject(42));            // => false
console.log(isObject(true));          // => false

Capabilities

Object Type Checking

Checks if a value is the ECMAScript language type of Object, including arrays, functions, objects, regexes, and boxed primitives.

/**
 * Checks if `value` is the ECMAScript language type of `Object`.
 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 */
function isObject(value);

Parameters:

  • value (*): The value to check

Returns:

  • boolean: Returns true if value is an object, else false

Behavior:

  • Returns true for ECMAScript language type of Object, which includes:
    • Plain objects ({})
    • Arrays ([])
    • Functions (function() {})
    • Regular expressions (/pattern/)
    • Dates (new Date())
    • Boxed primitives (new Number(), new String(), new Boolean())
    • Other object instances
  • Returns false for:
    • null (special case: typeof null === 'object' but null is falsy)
    • undefined
    • Primitive strings, numbers, booleans, symbols, and bigints
  • Implementation: !!value && (typeof value == 'object' || typeof value == 'function')

Usage Examples:

const isObject = require('lodash.isobject');

// Different object types
isObject({});                    // => true
isObject({ name: 'John' });      // => true
isObject([1, 2, 3]);            // => true
isObject(function hello() {});   // => true
isObject(/pattern/);             // => true
isObject(new Date());            // => true
isObject(new Number(42));        // => true

// Non-object types
isObject(null);                  // => false
isObject(undefined);             // => false
isObject('hello');               // => false
isObject(123);                   // => false
isObject(true);                  // => false
isObject(Symbol('sym'));         // => false