ut2
Version:
一个现代 JavaScript 实用工具库。[点击查看在线文档]。
25 lines (24 loc) • 632 B
TypeScript
/**
* 检查值是否为普通对象,即由 `Object` 构造函数创建或 `[[Prototype]]` 为 `null` 的对象。
*
* @alias module:Language.isPlainObject
* @since 1.0.0
* @param {*} value 要检查的值。
* @returns {boolean} 如果值为普通对象,返回 `true`,否则返回 `false`。
* @example
*
* function Foo(){
* this.a = 1;
* }
*
* isPlainObject(new Foo); // false
*
* isPlainObject([1,2,3]); // false
*
* isPlainObject({ a: 1, b: 2 }); // true
*
* isPlainObject(Object.create(null)); // true
*
*/
declare function isPlainObject(value: any): value is object;
export default isPlainObject;