|
21 | 21 | /// <reference types="@stdlib/types"/>
|
22 | 22 |
|
23 | 23 | import { ComplexLike, Complex64, Complex128 } from '@stdlib/types/complex';
|
24 |
| -import { DataType, Complex128Array, Complex64Array } from '@stdlib/types/array'; |
| 24 | +import { DataType, Complex128Array, Complex64Array, BooleanArray } from '@stdlib/types/array'; |
25 | 25 |
|
26 | 26 | /**
|
27 | 27 | * Returns a single-element array containing a provided scalar value.
|
@@ -49,6 +49,19 @@ declare function scalar2array( value: number, dtype: 'float64' ): Float64Array;
|
49 | 49 | */
|
50 | 50 | declare function scalar2array( value: number, dtype: 'float32' ): Float32Array;
|
51 | 51 |
|
| 52 | +/** |
| 53 | +* Returns a single-element array containing a provided scalar value. |
| 54 | +* |
| 55 | +* @param value - scalar value |
| 56 | +* @param dtype - output array data type |
| 57 | +* @returns output array |
| 58 | +* |
| 59 | +* @example |
| 60 | +* var x = scalar2array( true, 'bool' ); |
| 61 | +* // returns <BooleanArray> |
| 62 | +*/ |
| 63 | +declare function scalar2array( value: any, dtype: 'bool' ): BooleanArray; |
| 64 | + |
52 | 65 | /**
|
53 | 66 | * Returns a single-element array containing a provided scalar value.
|
54 | 67 | *
|
@@ -208,6 +221,19 @@ declare function scalar2array<T = unknown>( value: T, dtype: 'generic' ): Array<
|
208 | 221 | */
|
209 | 222 | declare function scalar2array( value: number ): Float64Array;
|
210 | 223 |
|
| 224 | +/** |
| 225 | +* Returns a single-element array containing a provided scalar value. |
| 226 | +* |
| 227 | +* @param value - scalar value |
| 228 | +* @param dtype - output array data type |
| 229 | +* @returns output array |
| 230 | +* |
| 231 | +* @example |
| 232 | +* var x = scalar2array( true ); |
| 233 | +* // returns <BooleanArray> |
| 234 | +*/ |
| 235 | +declare function scalar2array( value: boolean ): BooleanArray; |
| 236 | + |
211 | 237 | /**
|
212 | 238 | * Returns a single-element array containing a provided scalar value.
|
213 | 239 | *
|
@@ -249,7 +275,8 @@ declare function scalar2array( value: Complex128 | ComplexLike ): Complex128Arra
|
249 | 275 | *
|
250 | 276 | * - If a `dtype` argument is not provided and `value`
|
251 | 277 | *
|
252 |
| -* - is a `number`, the default data type is the default real-valued floating-point data type. |
| 278 | +* - is a number, the default data type is the default real-valued floating-point data type. |
| 279 | +* - is a boolean, the default data type is the default boolean data type. |
253 | 280 | * - is a complex number object of a known complex data type, the data type is the same as the provided value.
|
254 | 281 | * - is a complex number object of an unknown complex data type, the default data type is the default complex-valued floating-point data type.
|
255 | 282 | * - is any other value type, the default data type is `'generic'`.
|
|
0 commit comments