{"size": 1006, "ext": "js", "max_stars_repo_path": "plugin/function-plot/node_modules/integrate-adaptive-simpson/node_modules/compute-dtype/lib/index.js", "max_stars_repo_name": "egrosclaude/IC2016", "max_stars_repo_stars_event_min_datetime": "2015-05-23T09:44:53.000Z", "max_stars_repo_stars_event_max_datetime": "2015-11-04T12:56:10.000Z", "max_issues_repo_path": "plugin/function-plot/node_modules/integrate-adaptive-simpson/node_modules/compute-dtype/lib/index.js", "max_issues_repo_name": "egrosclaude/IC2016", "max_issues_repo_issues_event_min_datetime": "2015-06-02T23:46:48.000Z", "max_issues_repo_issues_event_max_datetime": "2015-06-03T04:52:45.000Z", "max_forks_repo_path": "plugin/function-plot/node_modules/integrate-adaptive-simpson/node_modules/compute-dtype/lib/index.js", "max_forks_repo_name": "egrosclaude/IC2016", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 18.2909090909, "max_line_length": 114, "alphanum_fraction": 0.6192842942}
'use strict';

// MODULES //

var typeName = require( 'type-name' ),
	getType = require( 'compute-array-dtype' );


// DTYPE //

/**
* FUNCTION: dtype( value )
*	Determines the data type of an input value.
*
* @param {*} value - input value
* @returns {String} data type
*/
function dtype( value ) {
	var type,
		dt;
	if ( value === null ) {
		return 'null';
	}
	// Check for base types:
	type = typeof value;
	switch ( type ) {
		case 'undefined':
		case 'boolean':
		case 'number':
		case 'string':
		case 'function':
		case 'symbol':
			return type;
	}
	// Resort to slower look-up:
	type = typeName( value );

	// Is value a known array type?
	dt = getType( type );
	if ( dt ) {
		return dt;
	}
	// Is value a buffer object?
	if ( type === 'Buffer' || type === 'ArrayBuffer' ) {
		return 'binary';
	}
	// Assume the value is a generic object (Object|Class instance) which could contain any or multiple data types...
	return 'generic';
} // end FUNCTION dtype()


// EXPORTS //

module.exports = dtype;
