get-explicit-type

1.0.2 • Public • Published

GetExplicitType

Returns any variable explicit type, taken from its constructor name:
{ Array | Arguments | Object | Function | RegExp | Number | String | Symbol | Promise }

Usage:

const GetType = require( 'get-explicit-type' );
 
// GetType( {obj|Mixed} ) => {String}
 
var type = GetType( [] );
 
console.log( type ) => 'Array'
 
 
/* ------------ Careful ------------- */
 
class Test {}
 
var type = GetType( new Test );
 
console.log( type ) => 'Object'
 

Package Sidebar

Install

npm i get-explicit-type

Weekly Downloads

1

Version

1.0.2

License

ISC

Last publish

Collaborators

  • krot47