From ebb86d128e6a5ec3bccc30edbcb697b413d00eef Mon Sep 17 00:00:00 2001 From: Jaysukh-409 Date: Thu, 6 Jun 2024 14:42:09 +0530 Subject: [PATCH] feat: add boolean datatype support in array/ctors --- lib/node_modules/@stdlib/array/ctors/README.md | 3 ++- lib/node_modules/@stdlib/array/ctors/docs/repl.txt | 1 + .../@stdlib/array/ctors/docs/types/index.d.ts | 13 +++++++++++++ .../@stdlib/array/ctors/docs/types/test.ts | 1 + lib/node_modules/@stdlib/array/ctors/lib/ctors.js | 4 +++- lib/node_modules/@stdlib/array/ctors/test/test.js | 9 ++++++--- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/array/ctors/README.md b/lib/node_modules/@stdlib/array/ctors/README.md index 45a066573e2f..88484049019c 100644 --- a/lib/node_modules/@stdlib/array/ctors/README.md +++ b/lib/node_modules/@stdlib/array/ctors/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. @@ -55,6 +55,7 @@ The function returns constructors for the following data types: - `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. diff --git a/lib/node_modules/@stdlib/array/ctors/docs/repl.txt b/lib/node_modules/@stdlib/array/ctors/docs/repl.txt index 6cea26e3fa81..6a7f5b2dc885 100644 --- a/lib/node_modules/@stdlib/array/ctors/docs/repl.txt +++ b/lib/node_modules/@stdlib/array/ctors/docs/repl.txt @@ -8,6 +8,7 @@ - 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. diff --git a/lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts index 887488a6eaf9..0c7c030585cd 100644 --- a/lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts @@ -20,6 +20,7 @@ import Complex128Array = require( '@stdlib/array/complex128' ); import Complex64Array = require( '@stdlib/array/complex64' ); +import BooleanArray = require( '@stdlib/array/bool' ); /** * Returns a `Float64Array` constructor. @@ -69,6 +70,18 @@ declare function ctors( dtype: 'complex128' ): typeof Complex128Array; */ declare function ctors( dtype: 'complex64' ): typeof Complex64Array; +/** +* Returns a `BooleanArray` constructor. +* +* @param dtype - data type +* @returns constructor +* +* @example +* var ctor = ctors( 'bool' ); +* // returns +*/ +declare function ctors( dtype: 'bool' ): typeof BooleanArray; + /** * Returns an `Int32Array` constructor. * diff --git a/lib/node_modules/@stdlib/array/ctors/docs/types/test.ts b/lib/node_modules/@stdlib/array/ctors/docs/types/test.ts index af3e90315ef2..45300bb6b076 100644 --- a/lib/node_modules/@stdlib/array/ctors/docs/types/test.ts +++ b/lib/node_modules/@stdlib/array/ctors/docs/types/test.ts @@ -27,6 +27,7 @@ import ctors = require( './index' ); ctors( 'float32' ); // $ExpectType Float32ArrayConstructor ctors( 'complex128' ); // $ExpectType Complex128ArrayConstructor ctors( 'complex64' ); // $ExpectType Complex64ArrayConstructor + ctors( 'bool' ); // $ExpectType BooleanArrayConstructor ctors( 'int32' ); // $ExpectType Int32ArrayConstructor ctors( 'int16' ); // $ExpectType Int16ArrayConstructor ctors( 'int8' ); // $ExpectType Int8ArrayConstructor diff --git a/lib/node_modules/@stdlib/array/ctors/lib/ctors.js b/lib/node_modules/@stdlib/array/ctors/lib/ctors.js index 64a458432166..174a3ed8cc6e 100644 --- a/lib/node_modules/@stdlib/array/ctors/lib/ctors.js +++ b/lib/node_modules/@stdlib/array/ctors/lib/ctors.js @@ -31,6 +31,7 @@ var Uint8Array = require( '@stdlib/array/uint8' ); var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var BooleanArray = require( '@stdlib/array/bool' ); // MAIN // @@ -48,7 +49,8 @@ var ctors = { 'uint8': Uint8Array, 'uint8c': Uint8ClampedArray, 'complex64': Complex64Array, - 'complex128': Complex128Array + 'complex128': Complex128Array, + 'bool': BooleanArray }; diff --git a/lib/node_modules/@stdlib/array/ctors/test/test.js b/lib/node_modules/@stdlib/array/ctors/test/test.js index 2116a2b343a7..18116a1f9d29 100644 --- a/lib/node_modules/@stdlib/array/ctors/test/test.js +++ b/lib/node_modules/@stdlib/array/ctors/test/test.js @@ -1,7 +1,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. @@ -33,6 +33,7 @@ var Uint8Array = require( '@stdlib/array/uint8' ); var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); var Complex64Array = require( '@stdlib/array/complex64' ); var Complex128Array = require( '@stdlib/array/complex128' ); +var BooleanArray = require( '@stdlib/array/bool' ); var isFunction = require( '@stdlib/assert/is-function' ); var ctors = require( './../lib' ); @@ -63,7 +64,8 @@ tape( 'the function returns array constructors', function test( t ) { 'uint8', 'uint8c', 'complex64', - 'complex128' + 'complex128', + 'bool' ]; expected = [ Float64Array, @@ -77,7 +79,8 @@ tape( 'the function returns array constructors', function test( t ) { Uint8Array, Uint8ClampedArray, Complex64Array, - Complex128Array + Complex128Array, + BooleanArray ]; for ( i = 0; i < dtypes.length; i++ ) { ctor = ctors( dtypes[ i ] );