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 = [
    'float64',
    'float32',
    'int8',
    'uint8',
    'uint8c',
    'int16',
    'uint16',
    'int32',
    'uint32',
    'binary',
    'generic',
    'foobar'
];

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