Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/node_modules/@stdlib/utils/type-of/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var ctorName = require( '@stdlib/utils/constructor-name' );
var lowercase = require( '@stdlib/string/base/lowercase' );


// NOTES //
Expand Down Expand Up @@ -53,6 +54,14 @@ var ctorName = require( '@stdlib/utils/constructor-name' );
*
* @param {*} v - input value
* @returns {string} string indicating the value's type
*
* @example
* var str = typeOf( 'a' );
* // returns 'string'
*
* @example
* var str = typeOf( 5 );
* // returns 'number'
*/
function typeOf( v ) {
var type;
Expand All @@ -65,7 +74,7 @@ function typeOf( v ) {

// If the `typeof` operator returned something other than `object`, we are done. Otherwise, we need to check for an internal class name or search for a constructor.
if ( type === 'object' ) {
return ctorName( v ).toLowerCase();
return lowercase( ctorName( v ) );
}
return type;
}
Expand Down
11 changes: 10 additions & 1 deletion lib/node_modules/@stdlib/utils/type-of/lib/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var ctorName = require( '@stdlib/utils/constructor-name' );
var lowercase = require( '@stdlib/string/base/lowercase' );


// MAIN //
Expand All @@ -30,9 +31,17 @@ var ctorName = require( '@stdlib/utils/constructor-name' );
*
* @param {*} v - input value
* @returns {string} string indicating the value's type
*
* @example
* var str = typeOf( 'a' );
* // returns 'string'
*
* @example
* var str = typeOf( 5 );
* // returns 'number'
*/
function typeOf( v ) {
return ctorName( v ).toLowerCase();
return lowercase( ctorName( v ) );
}


Expand Down
Loading