Skip to content

Commit 238db56

Browse files
Jaysukh-409aman-095
authored andcommitted
feat: add boolean dtype support in array/ctors
PR-URL: stdlib-js#2308 Ref: stdlib-js#2304 Reviewed-by: Athan Reines <[email protected]>
1 parent a230e27 commit 238db56

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

lib/node_modules/@stdlib/array/ctors/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
@license Apache-2.0
44
5-
Copyright (c) 2018 The Stdlib Authors.
5+
Copyright (c) 2024 The Stdlib Authors.
66
77
Licensed under the Apache License, Version 2.0 (the "License");
88
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:
5555
- `float64`: double-precision floating-point numbers.
5656
- `complex64`: single-precision complex floating-point numbers.
5757
- `complex128`: double-precision complex floating-point numbers.
58+
- `bool`: boolean values.
5859
- `generic`: values of any type.
5960
- `int16`: signed 16-bit integers.
6061
- `int32`: signed 32-bit integers.

lib/node_modules/@stdlib/array/ctors/docs/repl.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- float64: double-precision floating-point numbers.
99
- complex64: single-precision complex floating-point numbers.
1010
- complex128: double-precision complex floating-point numbers.
11+
- bool: boolean values.
1112
- generic: values of any type.
1213
- int16: signed 16-bit integers.
1314
- int32: signed 32-bit integers.

lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import Complex128Array = require( '@stdlib/array/complex128' );
2222
import Complex64Array = require( '@stdlib/array/complex64' );
23+
import BooleanArray = require( '@stdlib/array/bool' );
2324

2425
/**
2526
* Returns a `Float64Array` constructor.
@@ -69,6 +70,18 @@ declare function ctors( dtype: 'complex128' ): typeof Complex128Array;
6970
*/
7071
declare function ctors( dtype: 'complex64' ): typeof Complex64Array;
7172

73+
/**
74+
* Returns a `BooleanArray` constructor.
75+
*
76+
* @param dtype - data type
77+
* @returns constructor
78+
*
79+
* @example
80+
* var ctor = ctors( 'bool' );
81+
* // returns <Function>
82+
*/
83+
declare function ctors( dtype: 'bool' ): typeof BooleanArray;
84+
7285
/**
7386
* Returns an `Int32Array` constructor.
7487
*

lib/node_modules/@stdlib/array/ctors/docs/types/test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import ctors = require( './index' );
2727
ctors( 'float32' ); // $ExpectType Float32ArrayConstructor
2828
ctors( 'complex128' ); // $ExpectType Complex128ArrayConstructor
2929
ctors( 'complex64' ); // $ExpectType Complex64ArrayConstructor
30+
ctors( 'bool' ); // $ExpectType BooleanArrayConstructor
3031
ctors( 'int32' ); // $ExpectType Int32ArrayConstructor
3132
ctors( 'int16' ); // $ExpectType Int16ArrayConstructor
3233
ctors( 'int8' ); // $ExpectType Int8ArrayConstructor

lib/node_modules/@stdlib/array/ctors/lib/ctors.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var Uint8Array = require( '@stdlib/array/uint8' );
3131
var Uint8ClampedArray = require( '@stdlib/array/uint8c' );
3232
var Complex64Array = require( '@stdlib/array/complex64' );
3333
var Complex128Array = require( '@stdlib/array/complex128' );
34+
var BooleanArray = require( '@stdlib/array/bool' );
3435

3536

3637
// MAIN //
@@ -48,7 +49,8 @@ var ctors = {
4849
'uint8': Uint8Array,
4950
'uint8c': Uint8ClampedArray,
5051
'complex64': Complex64Array,
51-
'complex128': Complex128Array
52+
'complex128': Complex128Array,
53+
'bool': BooleanArray
5254
};
5355

5456

lib/node_modules/@stdlib/array/ctors/test/test.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@ var Uint8Array = require( '@stdlib/array/uint8' );
3333
var Uint8ClampedArray = require( '@stdlib/array/uint8c' );
3434
var Complex64Array = require( '@stdlib/array/complex64' );
3535
var Complex128Array = require( '@stdlib/array/complex128' );
36+
var BooleanArray = require( '@stdlib/array/bool' );
3637
var isFunction = require( '@stdlib/assert/is-function' );
3738
var ctors = require( './../lib' );
3839

@@ -63,7 +64,8 @@ tape( 'the function returns array constructors', function test( t ) {
6364
'uint8',
6465
'uint8c',
6566
'complex64',
66-
'complex128'
67+
'complex128',
68+
'bool'
6769
];
6870
expected = [
6971
Float64Array,
@@ -77,7 +79,8 @@ tape( 'the function returns array constructors', function test( t ) {
7779
Uint8Array,
7880
Uint8ClampedArray,
7981
Complex64Array,
80-
Complex128Array
82+
Complex128Array,
83+
BooleanArray
8184
];
8285
for ( i = 0; i < dtypes.length; i++ ) {
8386
ctor = ctors( dtypes[ i ] );

0 commit comments

Comments
 (0)