Data Types
List of array data types.
Usage
var dtypes = require( '@stdlib/array/dtypes' );
dtypes( [kind] )
Returns a list of array data types.
var out = dtypes();
// e.g., returns [ 'float32', 'float64', ... ]
When not provided a data type "kind", the function returns an array containing the following data types:
float32: single-precision floating-point numbers.float64: double-precision floating-point numbers.complex64: single-precision complex floating-point numbers.complex128: double-precision complex floating-point numbers.bool: boolean values.generic: values of any type.int16: signed 16-bit integers.int32: signed 32-bit integers.int8: signed 8-bit integers.uint16: unsigned 16-bit integers.uint32: unsigned 32-bit integers.uint8: unsigned 8-bit integers.uint8c: unsigned clamped 8-bit integers.
To return the subset of data types belonging to a specified data type kind, provide a kind argument.
var out = dtypes( 'floating_point' );
// returns [...]
The function supports the following data type kinds:
floating_point: floating-point data types.real_floating_point: real-valued floating-point data types.complex_floating_point: complex-valued floating-point data types.boolean: boolean data types.integer: integer data types.signed_integer: signed integer data types.unsigned_integer: unsigned integer data types.real: real-valued data types.numeric: numeric data types.typed: typed data types.all: all data types.
Additionally, the function supports extending the "kinds" listed above by appending an _and_generic suffix to the kind name (e.g., real_and_generic).
var out = dtypes( 'floating_point_and_generic' );
// returns [...]
Examples
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
var dtypes = require( '@stdlib/array/dtypes' );
var isdtype = contains( dtypes() );
var bool = isdtype( 'float64' );
// returns true
bool = isdtype( 'int8' );
// returns true
bool = isdtype( 'uint16' );
// returns true
bool = isdtype( 'beep' );
// returns false