Skip to content

mgenware/to-type-string

Repository files navigation

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

About

Get type description of a JavaScript variable

Resources

License

Stars

Watchers

Forks

Packages

No packages published