平面对象
回返
true如果对象是由Object或带有null原型车.
请考虑跟随这个项目的作者, 乔恩·斯林克特,并主演项目以显示你的qq和支持.
使用 对象 如果您只想要检查一个值是否是对象而不是数组,或者 null。 。 。 .
安装
npm install is-plain-object
使用量
使用ES模块:
import { isPlainObject } from 'is-plain-object';
isPlainObject({}); // true
isPlainObject({ foo: 'bar' }); // true
isPlainObject(Object.create(null)); // true
isPlainObject(Object.create({})); // true
isPlainObject(); // false
isPlainObject(null); // false
isPlainObject([]); // false
isPlainObject(new Date()); // false
isPlainObject(/foo/); // false
isPlainObject(() => {}); // false
带有 commonJS :
const { isPlainObject } = require('is-plain-object');
API 密码
isPlainObject(value)
回返 true 何时 value 是一个普通对象。 对象创建 Object 构造器和具有 null 原型被认为是平庸的.
发展
安装依赖关系,构建通用JS和ES模块捆绑,并运行测试:
npm install
npm run build
npm test
相关项目
许可证
麻省理工学院 乔恩·斯林克特