isPlainObject【判断普通对象类型】
描述
判断是否是一个普通对象({}), 返回值 boolean
# 1.示例
import { isPlainObject } from 'sf-utils2'
isPlainObject(null) // false
isPlainObject([]) // false
isPlainObject(123) // false
isPlainObject({}) // true
1
2
3
4
5
6
2
3
4
5
6
# 2.入参说明
| 参数 | 说明 | 类型 | 是否必填 |
|---|---|---|---|
| val | any | 是 |
# 3.源码
import _typeof from '@/base/_typeof'
/**
* 判断是否是一个普通对象
* @param {any} val
* @returns {boolean}
*/
function isPlainObject(val) {
return _typeof(val) === 'Object'
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
上次更新: 2024/01/08, 21:47:25