Skip to main content

isPlainObject

Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.

API

function isPlainObject(value: unknown): value is object;

Usage

import { isPlainObject } from '@feedzai/js-utilities';

isPlainObject({});
// true

isPlainObject([]);
// false

isPlainObject(null);
// false

isPlainObject(new Date());
// false

isPlainObject('string');
// false

isPlainObject(123);
// false

isPlainObject(Object.create(null));
// true