Function isPlainObject
Parameters
- value: unknown
Any value to evaluate.
Returns value is Record<string, unknown>
True if the value is a plain object with no special prototype.
- value: unknown
Any value to evaluate.
True if the value is a plain object with no special prototype.
Determines whether a value is a plain object.
A plain object is one whose prototype is either:
Object.prototype(created via{}ornew Object())null(created viaObject.create(null))This excludes arrays, functions, class instances, DOM objects, and any object with a custom prototype. In other words, this function detects JSON-like dictionary objects rather than structural or callable object types.
Type Behavior:
T, that type is preserved after narrowing.unknownor untyped the result narrows toRecord<string, unknown>allowing safe keyed access.Useful when validating configuration objects, cloning or merging data, performing deep equality, or working with structured JSON where non-plain / prototype values would be considered invalid.