Skip to main content

Built and signed on GitHub Actions

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (1.31.0)
function isPlainObject
isPlainObject(object?: unknown): boolean

Checks if a given value is a plain object.

A plain object is an object created by the {} literal, new Object(), or Object.create(null).

This function also handles objects with custom Symbol.toStringTag properties.

Symbol.toStringTag is a built-in symbol that a constructor can use to customize the default string description of objects.

Examples

Example 1

console.log(isPlainObject({})); // true console.log(isPlainObject([])); // false console.log(isPlainObject(null)); // false console.log(isPlainObject(Object.create(null))); // true console.log(isPlainObject(new Map())); // false

Parameters

optional
object: unknown
  • The value to check.

Return Type

  • True if the value is a plain object, otherwise false.

Add Package

deno add jsr:@es-toolkit/es-toolkit

Import symbol

import { isPlainObject } from "@es-toolkit/es-toolkit/compat";

---- OR ----

Import directly with a jsr specifier

import { isPlainObject } from "jsr:@es-toolkit/es-toolkit/compat";

Add Package

npx jsr add @es-toolkit/es-toolkit

Import symbol

import { isPlainObject } from "@es-toolkit/es-toolkit/compat";

Add Package

yarn dlx jsr add @es-toolkit/es-toolkit

Import symbol

import { isPlainObject } from "@es-toolkit/es-toolkit/compat";

Add Package

pnpm dlx jsr add @es-toolkit/es-toolkit

Import symbol

import { isPlainObject } from "@es-toolkit/es-toolkit/compat";

Add Package

bunx jsr add @es-toolkit/es-toolkit

Import symbol

import { isPlainObject } from "@es-toolkit/es-toolkit/compat";