Skip to main content

isPlainObject

A function that checks whether a given argument is a Plain Object.

A Plain Object refers to an object created via an object literal ({}) or new Object().


Code

🔗 View source code

Interface

typescript
const isPlainObject: (value: unknown) => value is Record<PropertyKey, any>

Usage

typescript
import { isPlainObject } from '@modern-kit/utils';

isPlainObject({}) // true
isPlainObject(new Object()) // true

isPlainObject(function() {}) // false
isPlainObject(() => {}) // false
isPlainObject([]) // false
isPlainObject(new Set()) // false
isPlainObject(new Map()) // false
isPlainObject(null) // false
isPlainObject(undefined) // false