enum2str

Return the policy string associated with an output ndarray data type policy enumeration constant.

Usage

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

enum2str( policy )

Returns the policy string associated with an output ndarray data type policy enumeration constant.

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

var v = str2enum( 'same' );
// returns <number>

var policy = enum2str( v );
// returns 'same'

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

var v = enum2str( -999999999 );
// returns null

Examples

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

var str = enum2str( str2enum( 'same' ) );
// returns 'same'

str = enum2str( str2enum( 'floating_point' ) );
// returns 'floating_point'

str = enum2str( str2enum( 'signed_integer' ) );
// returns 'signed_integer'

str = enum2str( str2enum( 'unsigned_integer' ) );
// returns 'unsigned_integer'

str = enum2str( str2enum( 'integer' ) );
// returns 'integer'

str = enum2str( str2enum( 'promoted' ) );
// returns 'promoted'

str = enum2str( str2enum( 'complex_floating_point' ) );
// returns 'complex_floating_point'

str = enum2str( str2enum( 'real_floating_point' ) );
// returns 'real_floating_point'
Did you find this page helpful?