@stdlib/ndarray-base-dtypes2enums
v0.1.1
Published
Resolve a list of data type enumeration constants.
Readme
dtypes2enums
Resolve a list of data type enumeration constants.
Installation
npm install @stdlib/ndarray-base-dtypes2enumsUsage
var dtypes2enums = require( '@stdlib/ndarray-base-dtypes2enums' );dtypes2enums( dtypes )
Resolves a list of data type enumeration constants.
var out = dtypes2enums( [ 'float32', 'float64' ] );
// returns [...]The function accepts the following arguments:
- dtypes: an array of data types.
If the function is unable to resolve an enumeration constant for a provided data type, the corresponding element in the returned array will be null.
var out = dtypes2enums( [ 'foo', 'bar' ] );
// returns [ null, null ]Examples
var dtypes = require( '@stdlib/ndarray-dtypes' );
var logEach = require( '@stdlib/console-log-each' );
var dtypes2enums = require( '@stdlib/ndarray-base-dtypes2enums' );
// Get the list of supported data types:
var dt = dtypes();
// Resolve enumeration constants:
var enums = dtypes2enums( dt );
// Print the results:
logEach( '%s => %d', dt, enums );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-2026. The Stdlib Authors.
