Skip to content

Function: isPlainObject() ​

ts
function isPlainObject(value): value is Record<PropertyKey, unknown>;

Checks whether a value is a plain object created by {} or Object.create(null). 检查值是否为由 {} 或 Object.create(null) 创建的普通对象。

Parameters ​

ParameterTypeDescription
valueunknownThe value to check / 要检查的值

Returns ​

value is Record<PropertyKey, unknown>

true when the value is a plain object / 值是普通对象时返回 true

Example ​

ts
isPlainObject({})
// => true

Since ​

1.2.0

Released under the MIT License.