---
title: "isPlainObject"
description: "检查一个值是否为“纯”对象（由 {} 或 new Object() 创建）。"
seo_title: "isPlainObject"
seo_description: "Check whether a value is a plain object created by an object literal or Object, excluding arrays, dates, functions, and class instances."
canonical_url: "https://core.mhaibaraai.cn/docs/validators/is-plain-object"
---
# isPlainObject

> 检查一个值是否为“纯”对象（由 {} 或 new Object() 创建）。

## 用法

检查一个值是否为“纯”对象（由 `{}` 或 `new Object()` 创建），排除数组、`null`、以及其他非对象类型（如 `new Date()`）。这是一个 TypeScript 类型保护函数。

```ts
import { isPlainObject } from '@movk/core'

isPlainObject({}) // => true
isPlainObject(new Object()) // => true
isPlainObject(new Date()) // => false
isPlainObject([]) // => false
```

## API

`isPlainObject(value: unknown): value is Record<string, any>`

### 参数

**value** (`unknown`) *required*: 需要检查的值。

### 返回值

**boolean**: 如果值为纯对象，则返回 true，否则返回 false。

## Changelog

See commit history for [src/validators/isPlainObject.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/validators/isPlainObject.ts).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
