dtypeDesc

Return the description for a specified data type.

Usage

var dtypeDesc = require( '@stdlib/ndarray/base/dtype-desc' );

dtypeDesc( [dtype] )

Returns the description for a specified data type.

var desc = dtypeDesc( 'float64' );
// returns '...'

desc = dtypeDesc( 'generic' );
// returns '...'

If provided an unknown or unsupported data type, the function returns null.

var desc = dtypeDesc( 'foobar' );
// returns null

If not provided a data type value, the function returns an object mapping data type strings to descriptions.

var obj = dtypeDesc();
// returns {...}

Examples

var dtypeDesc = require( '@stdlib/ndarray/base/dtype-desc' );

var dtypes;
var desc;
var i;

dtypes = [
    'float64',
    'float32',
    'int8',
    'uint8',
    'uint8c',
    'int16',
    'uint16',
    'int32',
    'uint32',
    'binary',
    'generic',
    'foobar'
];

for ( i = 0; i < dtypes.length; i++ ) {
    desc = dtypeDesc( dtypes[ i ] );
    console.log( '%s: %s', dtypes[ i ], desc );
}
Did you find this page helpful?