@gvray/eskit
Version:
A rich and colorful toolkit about typescript and javascript.
27 lines • 784 B
TypeScript
/**
* Gets the precise type of a value using Object.prototype.toString.
* 使用Object.prototype.toString获取值的精确类型。
*
* @param value - The value to get the type of / 要获取类型的值
* @returns The type name of the value / 值的类型名称
*
* @example
* ```typescript
* getType(42) // "Number"
* getType("hello") // "String"
* getType([1, 2, 3]) // "Array"
* getType({}) // "Object"
* getType(null) // "Null"
* getType(undefined) // "Undefined"
* getType(/regex/) // "RegExp"
* getType(new Date()) // "Date"
* getType(() => {}) // "Function"
* getType(new Map()) // "Map"
* getType(new Set()) // "Set"
* ```
*
* @since 1.0.0
*/
declare const getType: (value: any) => string;
export default getType;
//# sourceMappingURL=getType.d.ts.map