@stdlib/ndarray-base-dtype-alignment
v0.1.1
Published
Return the alignment (in bytes) for an underlying array data type.
Readme
dtypeAlignment
Return the alignment (in bytes) for an underlying array data type.
Installation
npm install @stdlib/ndarray-base-dtype-alignmentUsage
var dtypeAlignment = require( '@stdlib/ndarray-base-dtype-alignment' );dtypeAlignment( [dtype] )
Returns the alignment (in bytes) for an underlying array data type.
var out = dtypeAlignment( 'float64' );
// returns 8
out = dtypeAlignment( 'generic' );
// returns nullIf provided an unknown or unsupported data type, the function returns null.
var out = dtypeAlignment( 'foobar' );
// returns nullIf not provided a data type value, the function returns an object mapping data type strings to alignments (in bytes).
var obj = dtypeAlignment();
// returns {...}Examples
var logEachMap = require( '@stdlib/console-log-each-map' );
var dtypeAlignment = require( '@stdlib/ndarray-base-dtype-alignment' );
var dtypes = [
'float64',
'float32',
'int8',
'uint8',
'uint8c',
'int16',
'uint16',
'int32',
'uint32',
'binary',
'generic',
'foobar'
];
logEachMap( '%s => %s', dtypes, dtypeAlignment );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.
