@stdlib/array-empty-like 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -20
- package/docs/types/index.d.ts +2 -17
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
@license Apache-2.0
|
|
4
4
|
|
|
5
|
-
Copyright (c)
|
|
5
|
+
Copyright (c) 2024 The Stdlib Authors.
|
|
6
6
|
|
|
7
7
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
8
|
you may not use this file except in compliance with the License.
|
|
@@ -65,7 +65,7 @@ var emptyLike = require( '@stdlib/array-empty-like' );
|
|
|
65
65
|
|
|
66
66
|
#### emptyLike( x\[, dtype] )
|
|
67
67
|
|
|
68
|
-
Creates an uninitialized array having the same length and data type as a provided array `x`.
|
|
68
|
+
Creates an uninitialized array having the same length and [data type][@stdlib/array/dtypes] as a provided array `x`.
|
|
69
69
|
|
|
70
70
|
```javascript
|
|
71
71
|
var x = [ 1, 2, 3, 4, 5 ];
|
|
@@ -74,22 +74,7 @@ var arr = emptyLike( x );
|
|
|
74
74
|
// returns [ 0, 0, 0, 0, 0 ];
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- `float64`: double-precision floating-point numbers (IEEE 754)
|
|
80
|
-
- `float32`: single-precision floating-point numbers (IEEE 754)
|
|
81
|
-
- `complex128`: double-precision complex floating-point numbers
|
|
82
|
-
- `complex64`: single-precision complex floating-point numbers
|
|
83
|
-
- `int32`: 32-bit two's complement signed integers
|
|
84
|
-
- `uint32`: 32-bit unsigned integers
|
|
85
|
-
- `int16`: 16-bit two's complement signed integers
|
|
86
|
-
- `uint16`: 16-bit unsigned integers
|
|
87
|
-
- `int8`: 8-bit two's complement signed integers
|
|
88
|
-
- `uint8`: 8-bit unsigned integers
|
|
89
|
-
- `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
90
|
-
- `generic`: generic JavaScript values
|
|
91
|
-
|
|
92
|
-
By default, the output array data type is inferred from the provided array `x`. To return an array having a different data type, provide a `dtype` argument.
|
|
77
|
+
By default, the output array [data type][@stdlib/array/dtypes] is inferred from the provided array `x`. To return an array having a different [data type][@stdlib/array/dtypes], provide a `dtype` argument.
|
|
93
78
|
|
|
94
79
|
```javascript
|
|
95
80
|
var x = [ 1, 1 ];
|
|
@@ -213,8 +198,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
213
198
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-empty-like.svg
|
|
214
199
|
[npm-url]: https://npmjs.org/package/@stdlib/array-empty-like
|
|
215
200
|
|
|
216
|
-
[test-image]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
217
|
-
[test-url]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml?query=branch:v0.
|
|
201
|
+
[test-image]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
202
|
+
[test-url]: https://github.com/stdlib-js/array-empty-like/actions/workflows/test.yml?query=branch:v0.3.0
|
|
218
203
|
|
|
219
204
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-empty-like/main.svg
|
|
220
205
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-empty-like?branch=main
|
|
@@ -246,6 +231,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
246
231
|
|
|
247
232
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-empty-like/main/LICENSE
|
|
248
233
|
|
|
234
|
+
[@stdlib/array/dtypes]: https://www.npmjs.com/package/@stdlib/array-dtypes
|
|
235
|
+
|
|
249
236
|
<!-- <related-links> -->
|
|
250
237
|
|
|
251
238
|
[@stdlib/array/empty]: https://www.npmjs.com/package/@stdlib/array-empty
|
package/docs/types/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import { AnyArray, DataTypeMap, TypedArray, ComplexTypedArray } from '@stdlib/types/array';
|
|
23
|
+
import { AnyArray, DataTypeMap, TypedArray, BooleanTypedArray, ComplexTypedArray } from '@stdlib/types/array';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Creates an uninitialized array having the same length and data type as a provided input array.
|
|
@@ -64,7 +64,7 @@ declare function emptyLike( x: Array<any> ): Array<number>;
|
|
|
64
64
|
* var arr = emptyLike( x, 'float32' );
|
|
65
65
|
* // returns <Float32Array>
|
|
66
66
|
*/
|
|
67
|
-
declare function emptyLike<T extends TypedArray | ComplexTypedArray>( x: T ): T;
|
|
67
|
+
declare function emptyLike<T extends TypedArray | ComplexTypedArray | BooleanTypedArray>( x: T ): T;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Creates an uninitialized array having the same length as a provided input array.
|
|
@@ -75,21 +75,6 @@ declare function emptyLike<T extends TypedArray | ComplexTypedArray>( x: T ): T;
|
|
|
75
75
|
* - If `dtype` is `'generic'`, the function always returns a zero-filled array.
|
|
76
76
|
* - In Node.js versions `>=3.0.0`, the underlying memory of returned typed arrays is **not** initialized. Memory contents are unknown and may contain **sensitive** data.
|
|
77
77
|
*
|
|
78
|
-
* The function recognizes the following data types:
|
|
79
|
-
*
|
|
80
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
81
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
82
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
83
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
84
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
85
|
-
* - `uint32`: 32-bit unsigned integers
|
|
86
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
87
|
-
* - `uint16`: 16-bit unsigned integers
|
|
88
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
89
|
-
* - `uint8`: 8-bit unsigned integers
|
|
90
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
91
|
-
* - `generic`: generic JavaScript values
|
|
92
|
-
*
|
|
93
78
|
* @param x - input array from which to derive the output array length
|
|
94
79
|
* @param dtype - data type
|
|
95
80
|
* @returns empty array
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-empty-like",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Create an uninitialized array having the same length and data type as a provided array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@stdlib/array-dtype": "^0.2.1",
|
|
34
34
|
"@stdlib/array-empty": "^0.2.1",
|
|
35
|
-
"@stdlib/string-format": "^0.2.
|
|
36
|
-
"@stdlib/error-tools-fmtprodmsg": "^0.2.
|
|
35
|
+
"@stdlib/string-format": "^0.2.2",
|
|
36
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {},
|
|
39
39
|
"engines": {
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"uint8clampedarray",
|
|
76
76
|
"complex128array",
|
|
77
77
|
"complex64array",
|
|
78
|
+
"booleanarray",
|
|
78
79
|
"complex128",
|
|
79
80
|
"complex64",
|
|
80
81
|
"complex",
|
|
@@ -101,6 +102,7 @@
|
|
|
101
102
|
"clamped",
|
|
102
103
|
"short",
|
|
103
104
|
"long",
|
|
105
|
+
"bool",
|
|
104
106
|
"generic",
|
|
105
107
|
"empty",
|
|
106
108
|
"empty-like"
|