resolve

Return the data type string associated with a supported ndarray data type value.

Usage

var resolve = require( '@stdlib/ndarray/base/dtype-resolve-str' );

resolve( dtype )

Returns the data type string associated with an ndarray data type value.

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

var v = resolve( 'float64' );
// returns 'float64'

v = resolve( str2enum( 'float64' ) );
// returns 'float64'

If unable to resolve a data type string, the function returns null.

var v = resolve( 'beep' );
// returns null

Examples

var str2enum = require( '@stdlib/ndarray/base/dtype-str2enum' );
var resolve = require( '@stdlib/ndarray/base/dtype-resolve-str' );

var v = resolve( str2enum( 'float64' ) );
// returns 'float64'

v = resolve( str2enum( 'float32' ) );
// returns 'float32'

v = resolve( str2enum( 'int32' ) );
// returns 'int32'

v = resolve( str2enum( 'int16' ) );
// returns 'int16'

v = resolve( str2enum( 'int8' ) );
// returns 'int8'

v = resolve( str2enum( 'uint32' ) );
// returns 'uint32'

v = resolve( str2enum( 'uint16' ) );
// returns 'uint16'

v = resolve( str2enum( 'uint8' ) );
// returns 'uint8'
Did you find this page helpful?