to-type-string
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

to-type-string

Build Status npm version Node.js Version

Get type description of a JavaScript variable

Installation

npm install to-type-string

Usage

import toTypeString from 'to-type-string';

class MyClass {}

toTypeString(null); // null
toTypeString(undefined); // undefined
toTypeString(new MyClass()); // MyClass
toTypeString([1, 3, 2]); // Array
toTypeString(() => 'haha'); // function
toTypeString(/abc/); // RegExp
toTypeString(NaN); // number
toTypeString(new Uint16Array(10)); // Uint16Array
toTypeString(new Date()); // Date
toTypeString(new Object()); // Object

/to-type-string/

    Package Sidebar

    Install

    npm i to-type-string

    Weekly Downloads

    5

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    4.57 kB

    Total Files

    6

    Last publish

    Collaborators

    • mgenware