resolve

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

Usage

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

resolve( dtype )

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

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

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

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

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

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

Examples

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

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

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

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

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

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

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

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

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