get-explicit-type
v1.0.2
Published
Returns object constructor name
Downloads
7
Readme
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'