@stdlib/ndarray-base-output-policy-enum2str
v0.2.2
Published
Return the data type string associated with an ndarray data type enumeration constant.
Downloads
44
Readme
enum2str
Return the policy string associated with an output ndarray data type policy enumeration constant.
Installation
npm install @stdlib/ndarray-base-output-policy-enum2str
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'
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.