Skip to content

isPlainObject

Check if value is a plain object (created by {} or new Object()).

Usage

js
import { isPlainObject } from 'js-cool'

Signature

typescript
function isPlainObject(value: any): value is Record<string, any>

Parameters

ParameterTypeDescription
valueanyValue to check

Returns

boolean - true if value is a plain object.

Examples

js
isPlainObject({}) // true
isPlainObject({ a: 1 }) // true
isPlainObject(new Date()) // false
isPlainObject([]) // false
isPlainObject(null) // false

Released under the MIT License.