UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

21 lines 802 B
/** * Gives a single-word string description of the (native) type of a value, returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not attempt to distinguish user Object types any further, reporting them all as 'Object'. * @param val * @signature * P.type(obj) * @example * P.type({}); //=> "Object" * P.type(1); //=> "Number" * P.type(false); //=> "Boolean" * P.type('s'); //=> "String" * P.type(null); //=> "Null" * P.type([]); //=> "Array" * P.type(/[A-z]/); //=> "RegExp" * P.type(() => {}); //=> "Function" * P.type(undefined); //=> "Undefined" * P.type(new Date()); //=> "Date" * P.type(new MyClass()); // => "MyClass" * @category Utility */ export declare function type(val: any): string; //# sourceMappingURL=type.d.ts.map