对象

导入

TypeScript
import { isPlainObject } from 'vanilla-jui';

isPlainObject

isPlainObject(value) 判断值是否为普通对象。

  • 对象字面量和 Object.create(null) 返回 true
  • 数组、函数、DOM 节点和 class 实例返回 false
TypeScript
isPlainObject({ value: 1 }); // trueisPlainObject([]); // falseisPlainObject(new Date()); // false

schema 中可使用 type: 'plainObject',或在 type: 'object' 的基础上使用 plain: true

最后更新于 2026-09-22 16:24:10 UTC+8