UNPKG

type-tls

Version:

type-tls 封装了与类型相关的工具,比如:获取数据的类型 或 类型名字、判断数据的类型 等

60 lines (29 loc) 949 B
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [type-tls](./type-tls.md) &gt; [isObject](./type-tls.isobject.md) ## isObject() function 判断目标是否是对象类型 **Signature:** ```typescript export declare function isObject(target: any): boolean; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> target </td><td> any </td><td> : any 目标对象 </td></tr> </tbody></table> **Returns:** boolean ## Remarks 仅通过 target instanceof Object 判断是不行的,因为 对于 Object.create(null) 创建的对象 通过 ` Object.create(null) instanceof Object ` 来判断 返回的是 false 即:通过 Object.create(null) 创建的对象是不被 instanceof 认为是继续于 Object 的 typeof null 也返回 "object"