diff --git a/lib/node_modules/@stdlib/ndarray/dtypes/README.md b/lib/node_modules/@stdlib/ndarray/dtypes/README.md index 2ecd8167b86a..c9885cf90bf9 100644 --- a/lib/node_modules/@stdlib/ndarray/dtypes/README.md +++ b/lib/node_modules/@stdlib/ndarray/dtypes/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2018 The Stdlib Authors. +Copyright (c) 2024 The Stdlib Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -52,6 +52,7 @@ var out = dtypes(); When not provided a data type "kind", the function returns an array containing the following data types: - `binary`: binary. +- `bool`: boolean values. - `complex64`: single-precision complex floating-point numbers. - `complex128`: double-precision complex floating-point numbers. - `float32`: single-precision floating-point numbers. @@ -77,6 +78,7 @@ 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. @@ -106,17 +108,10 @@ The function supports the following data type kinds: ```javascript -var indexOf = require( '@stdlib/utils/index-of' ); +var contains = require( '@stdlib/array/base/assert/contains' ).factory; var dtypes = require( '@stdlib/ndarray/dtypes' ); -var DTYPES = dtypes(); - -function isdtype( str ) { - if ( indexOf( DTYPES, str ) === -1 ) { - return false; - } - return true; -} +var isdtype = contains( dtypes() ); var bool = isdtype( 'float64' ); // returns true diff --git a/lib/node_modules/@stdlib/ndarray/dtypes/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/dtypes/docs/repl.txt index e653135cc001..8d41c200d8aa 100644 --- a/lib/node_modules/@stdlib/ndarray/dtypes/docs/repl.txt +++ b/lib/node_modules/@stdlib/ndarray/dtypes/docs/repl.txt @@ -7,6 +7,7 @@ - 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. diff --git a/lib/node_modules/@stdlib/ndarray/dtypes/examples/index.js b/lib/node_modules/@stdlib/ndarray/dtypes/examples/index.js index dffc96660208..c781abb1f6a8 100644 --- a/lib/node_modules/@stdlib/ndarray/dtypes/examples/index.js +++ b/lib/node_modules/@stdlib/ndarray/dtypes/examples/index.js @@ -18,17 +18,10 @@ 'use strict'; -var indexOf = require( '@stdlib/utils/index-of' ); +var contains = require( '@stdlib/array/base/assert/contains' ).factory; var dtypes = require( './../lib' ); -var DTYPES = dtypes(); - -function isdtype( str ) { - if ( indexOf( DTYPES, str ) === -1 ) { - return false; - } - return true; -} +var isdtype = contains( dtypes() ); var bool = isdtype( 'float64' ); console.log( bool ); diff --git a/lib/node_modules/@stdlib/ndarray/dtypes/lib/dtypes.json b/lib/node_modules/@stdlib/ndarray/dtypes/lib/dtypes.json index d9aacf2350e5..388acce3abde 100644 --- a/lib/node_modules/@stdlib/ndarray/dtypes/lib/dtypes.json +++ b/lib/node_modules/@stdlib/ndarray/dtypes/lib/dtypes.json @@ -1,6 +1,7 @@ { "all": [ "binary", + "bool", "complex64", "complex128", "float32", @@ -16,6 +17,7 @@ ], "typed": [ "binary", + "bool", "complex64", "complex128", "float32", @@ -42,6 +44,9 @@ "complex64", "complex128" ], + "boolean": [ + "bool" + ], "integer": [ "int16", "int32", diff --git a/lib/node_modules/@stdlib/ndarray/dtypes/test/test.js b/lib/node_modules/@stdlib/ndarray/dtypes/test/test.js index 863ded24bab8..73b146758fe1 100644 --- a/lib/node_modules/@stdlib/ndarray/dtypes/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/dtypes/test/test.js @@ -43,7 +43,9 @@ var DTYPES = [ 'float64', 'complex64', - 'complex128' + 'complex128', + + 'bool' ]; @@ -61,6 +63,7 @@ tape( 'the function returns a list of ndarray data types', function test( t ) { expected = [ 'binary', + 'bool', 'complex64', 'complex128', 'float32', @@ -86,6 +89,7 @@ tape( 'the function supports returning a list of ndarray data types (all)', func expected = [ 'binary', + 'bool', 'complex64', 'complex128', 'float32', @@ -111,6 +115,7 @@ tape( 'the function supports returning a list of ndarray data types (typed)', fu expected = [ 'binary', + 'bool', 'complex64', 'complex128', 'float32', @@ -173,6 +178,19 @@ tape( 'the function supports returning a list of complex-valued floating-point n t.end(); }); +tape( 'the function supports returning a list of boolean ndarray data types', function test( t ) { + var expected; + var actual; + + expected = [ + 'bool' + ]; + actual = dtypes( 'boolean' ); + + t.deepEqual( actual, expected, 'returns expected value' ); + t.end(); +}); + tape( 'the function supports returning a list of integer ndarray data types', function test( t ) { var expected; var actual; diff --git a/lib/node_modules/@stdlib/types/index.d.ts b/lib/node_modules/@stdlib/types/index.d.ts index d982705d4fbc..055e22a26622 100644 --- a/lib/node_modules/@stdlib/types/index.d.ts +++ b/lib/node_modules/@stdlib/types/index.d.ts @@ -1391,62 +1391,122 @@ declare module '@stdlib/types/ndarray' { /** * Data type. */ - type DataType = NumericDataType | 'binary' | 'generic'; // "all" + type DataType = NumericDataType | BooleanDataType | 'binary' | 'generic'; // "all" /** * Data type for real-valued ndarrays. */ type RealDataType = RealFloatingPointDataType | IntegerDataType; // "real" + /** + * Data type for real-valued ndarrays. + */ + type RealAndGenericDataType = RealDataType | 'generic'; // "real_and_generic" + /** * Data type for floating-point ndarrays. */ type RealFloatingPointDataType = 'float64' | 'float32'; // "real_floating_point" + /** + * Data type for floating-point ndarrays. + */ + type RealFloatingPointAndGenericDataType = RealFloatingPointDataType | 'generic'; // "real_floating_point_and_generic" + /** * Data type for integer ndarrays. */ type IntegerDataType = SignedIntegerDataType | UnsignedIntegerDataType; // "integer" + /** + * Data type for integer ndarrays. + */ + type IntegerAndGenericDataType = IntegerDataType | 'generic'; // "integer_and_generic" + /** * Data type for signed integer ndarrays. */ type SignedIntegerDataType = 'int32' | 'int16' | 'int8'; // "signed_integer" + /** + * Data type for signed integer ndarrays. + */ + type SignedIntegerAndGenericDataType = SignedIntegerDataType | 'generic'; // "signed_integer_and_generic" + /** * Data type for unsigned integer ndarrays. */ type UnsignedIntegerDataType = 'uint32' | 'uint16' | 'uint8' | 'uint8c'; // "unsigned_integer" + /** + * Data type for unsigned integer ndarrays. + */ + type UnsignedIntegerAndGenericDataType = UnsignedIntegerDataType | 'generic'; // "unsigned_integer_and_generic" + /** * Data type for complex number ndarrays. */ type ComplexFloatingPointDataType = 'complex64' | 'complex128'; // "complex_floating_point" + /** + * Data type for complex number ndarrays. + */ + type ComplexFloatingPointAndGenericDataType = ComplexFloatingPointDataType | 'generic'; // "complex_floating_point_and_generic" + /** * Data type for floating-point real or complex ndarrays. */ type FloatingPointDataType = RealFloatingPointDataType | ComplexFloatingPointDataType; // "floating_point" + /** + * Data type for floating-point real or complex ndarrays. + */ + type FloatingPointAndGenericDataType = FloatingPointDataType | 'generic'; // "floating_point_and_generic" + /** * Data type for real-valued or complex number ndarrays. */ type NumericDataType = RealDataType | ComplexFloatingPointDataType; // "numeric" + /** + * Data type for real-valued or complex number ndarrays. + */ + type NumericAndGenericDataType = NumericDataType | 'generic'; // "numeric_and_generic" + + /** + * Data type for boolean typed arrays. + */ + type BooleanDataType = 'bool'; // "boolean" + + /** + * Data type for boolean and generic ndarrays. + */ + type BooleanAndGenericDataType = BooleanDataType | 'generic'; // "boolean_and_generic" + /** * Data type for strictly "typed" ndarrays. */ - type TypedDataType = NumericDataType; // "typed" + type TypedDataType = NumericDataType | BooleanDataType; // "typed" + + /** + * Data type for strictly typed and generic ndarrays. + */ + type TypedAndGenericDataType = TypedDataType | 'generic'; // "typed_and_generic" + + /** + * Strict data type "kinds". + */ + type StrictDataTypeKind = 'typed' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer' | 'boolean'; /** * Data type "kinds". */ - type DataTypeKind = 'all' | 'typed' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer'; + type DataTypeKind = StrictDataTypeKind | 'all' | 'typed_and_generic' | 'numeric_and_generic' | 'real_and_generic' | 'floating_point_and_generic' | 'real_floating_point_and_generic' | 'complex_floating_point_and_generic' | 'integer_and_generic' | 'signed_integer_and_generic' | 'unsigned_integer_and_generic' | 'boolean_and_generic'; /** * Output data type policy. */ - type OutputPolicy = 'default' | 'same' | 'promoted' | 'bool' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer'; + type OutputPolicy = 'default' | 'same' | 'promoted' | 'boolean' | 'numeric' | 'real' | 'floating_point' | 'real_floating_point' | 'complex_floating_point' | 'integer' | 'signed_integer' | 'unsigned_integer'; /** * Array order.