Skip to content

feat: add boolean datatype support in array/ctors #2308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/node_modules/@stdlib/array/ctors/README.md
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions lib/node_modules/@stdlib/array/ctors/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -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.
13 changes: 13 additions & 0 deletions lib/node_modules/@stdlib/array/ctors/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -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 <Function>
*/
declare function ctors( dtype: 'bool' ): typeof BooleanArray;

/**
* Returns an `Int32Array` constructor.
*
1 change: 1 addition & 0 deletions lib/node_modules/@stdlib/array/ctors/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion lib/node_modules/@stdlib/array/ctors/lib/ctors.js
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
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 //
@@ -39,7 +40,7 @@
var ctors = {
'float64': Float64Array,
'float32': Float32Array,
'generic': Array, // TODO: replace with `stdlib` pkg

Check warning on line 43 in lib/node_modules/@stdlib/array/ctors/lib/ctors.js

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: replace with `stdlib` pkg'
'int16': Int16Array,
'int32': Int32Array,
'int8': Int8Array,
@@ -48,7 +49,8 @@
'uint8': Uint8Array,
'uint8c': Uint8ClampedArray,
'complex64': Complex64Array,
'complex128': Complex128Array
'complex128': Complex128Array,
'bool': BooleanArray
};


9 changes: 6 additions & 3 deletions lib/node_modules/@stdlib/array/ctors/test/test.js
Original file line number Diff line number Diff line change
@@ -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 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,12 +64,13 @@
'uint8',
'uint8c',
'complex64',
'complex128'
'complex128',
'bool'
];
expected = [
Float64Array,
Float32Array,
Array, // TODO: explicitly require

Check warning on line 73 in lib/node_modules/@stdlib/array/ctors/test/test.js

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: explicitly require'
Int16Array,
Int32Array,
Int8Array,
@@ -77,7 +79,8 @@
Uint8Array,
Uint8ClampedArray,
Complex64Array,
Complex128Array
Complex128Array,
BooleanArray
];
for ( i = 0; i < dtypes.length; i++ ) {
ctor = ctors( dtypes[ i ] );