@stdlib/array-full-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/NOTICE +1 -1
- package/README.md +11 -24
- package/dist/index.js +18 -4
- package/dist/index.js.map +2 -2
- package/docs/types/index.d.ts +39 -196
- package/lib/main.js +2 -2
- package/package.json +6 -6
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
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 fullLike = require( '@stdlib/array-full-like' );
|
|
|
65
65
|
|
|
66
66
|
#### fullLike( x, value\[, dtype] )
|
|
67
67
|
|
|
68
|
-
Creates a filled array having the same length and data type as a provided array `x`.
|
|
68
|
+
Creates a filled 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 = fullLike( x, 1 );
|
|
|
74
74
|
// returns [ 1, 1, 1, 1, 1 ]
|
|
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 ];
|
|
@@ -108,7 +93,7 @@ var arr = fullLike( x, 1, 'int32' );
|
|
|
108
93
|
|
|
109
94
|
## Notes
|
|
110
95
|
|
|
111
|
-
- If provided a number and the output array data type is a complex number data type, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
96
|
+
- If provided a number and the output array [data type][@stdlib/array/dtypes] is a complex number [data type][@stdlib/array/dtypes], the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
112
97
|
|
|
113
98
|
</section>
|
|
114
99
|
|
|
@@ -196,7 +181,7 @@ See [LICENSE][stdlib-license].
|
|
|
196
181
|
|
|
197
182
|
## Copyright
|
|
198
183
|
|
|
199
|
-
Copyright © 2016-
|
|
184
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
200
185
|
|
|
201
186
|
</section>
|
|
202
187
|
|
|
@@ -209,8 +194,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
209
194
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-full-like.svg
|
|
210
195
|
[npm-url]: https://npmjs.org/package/@stdlib/array-full-like
|
|
211
196
|
|
|
212
|
-
[test-image]: https://github.com/stdlib-js/array-full-like/actions/workflows/test.yml/badge.svg?branch=v0.
|
|
213
|
-
[test-url]: https://github.com/stdlib-js/array-full-like/actions/workflows/test.yml?query=branch:v0.
|
|
197
|
+
[test-image]: https://github.com/stdlib-js/array-full-like/actions/workflows/test.yml/badge.svg?branch=v0.3.0
|
|
198
|
+
[test-url]: https://github.com/stdlib-js/array-full-like/actions/workflows/test.yml?query=branch:v0.3.0
|
|
214
199
|
|
|
215
200
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-full-like/main.svg
|
|
216
201
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-full-like?branch=main
|
|
@@ -222,8 +207,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
222
207
|
|
|
223
208
|
-->
|
|
224
209
|
|
|
225
|
-
[chat-image]: https://img.shields.io/
|
|
226
|
-
[chat-url]: https://
|
|
210
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
211
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
227
212
|
|
|
228
213
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
229
214
|
|
|
@@ -242,6 +227,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
242
227
|
|
|
243
228
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-full-like/main/LICENSE
|
|
244
229
|
|
|
230
|
+
[@stdlib/array/dtypes]: https://www.npmjs.com/package/@stdlib/array-dtypes
|
|
231
|
+
|
|
245
232
|
<!-- <related-links> -->
|
|
246
233
|
|
|
247
234
|
[@stdlib/array/full]: https://www.npmjs.com/package/@stdlib/array-full
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
"use strict";var u=function(t,r){return function(){return r||t((r={exports:{}}).exports,r),r.exports}};var n=u(function(g,a){
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";var u=function(t,r){return function(){return r||t((r={exports:{}}).exports,r),r.exports}};var n=u(function(g,a){"use strict";var l=require("@stdlib/string-format"),s=require("@stdlib/array-dtype"),m=require("@stdlib/array-full"),o=require("@stdlib/complex-float64-ctor"),p=require("@stdlib/complex-float32-ctor");function f(t,r){var e,i;if(e=s(t),e===null)throw new TypeError(l("invalid argument. First argument must be either an array, typed array, or complex typed array. Value: `%s`.",t));return arguments.length>2&&(e=arguments[2]),typeof r=="number"?e==="complex128"?i=new o(r,0):e==="complex64"?i=new p(r,0):i=r:i=r,m(t.length,i,e)}a.exports=f});var y=n();module.exports=y;
|
|
2
|
+
/**
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2022 The Stdlib Authors.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
5
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( '@stdlib/string-format' );\nvar dtype = require( '@stdlib/array-dtype' );\nvar full = require( '@stdlib/array-full' );\nvar Complex128 = require( '@stdlib/complex-float64' );\nvar Complex64 = require( '@stdlib/complex-float32' );\n\n\n// MAIN //\n\n/**\n* Creates a filled array having the same length and data type as a provided input array.\n*\n* @param {(Array|TypedArray|ComplexArray)} x - input array\n* @param {number} value - fill value\n* @param {string} [dtype] - data type\n* @throws {TypeError} first argument must be an array or typed array\n* @throws {TypeError} third argument must be a recognized data type\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0, 'float32' );\n* // returns <Float32Array>[ 1.0, 1.0 ]\n*/\nfunction fullLike( x, value ) {\n\tvar dt;\n\tvar v;\n\n\tdt = dtype( x ); // delegate input argument validation to dtype resolution\n\tif ( dt === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be either an array, typed array, or complex typed array. Value: `%s`.', x ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tdt = arguments[ 2 ];\n\t}\n\tif ( typeof value === 'number' ) {\n\t\tif ( dt === 'complex128' ) {\n\t\t\tv = new Complex128( value, 0.0 );\n\t\t} else if ( dt === 'complex64' ) {\n\t\t\tv = new Complex64( value, 0.0 );\n\t\t} else {\n\t\t\tv = value;\n\t\t}\n\t} else {\n\t\tv = value;\n\t}\n\treturn full( x.length, v, dt );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fullLike;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create a filled array having the same length and data type as a provided input array.\n*\n* @module @stdlib/array-full-like\n*\n* @example\n* var fullLike = require( '@stdlib/array-full-like' );\n*\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var fullLike = require( '@stdlib/array-full-like' );\n*\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0, 'float32' );\n* // returns <Float32Array>[ 1.0, 1.0 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
-
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,qBAAsB,EACvCC,EAAO,QAAS,oBAAqB,EACrCC,EAAa,QAAS,
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( '@stdlib/string-format' );\nvar dtype = require( '@stdlib/array-dtype' );\nvar full = require( '@stdlib/array-full' );\nvar Complex128 = require( '@stdlib/complex-float64-ctor' );\nvar Complex64 = require( '@stdlib/complex-float32-ctor' );\n\n\n// MAIN //\n\n/**\n* Creates a filled array having the same length and data type as a provided input array.\n*\n* @param {(Array|TypedArray|ComplexArray)} x - input array\n* @param {number} value - fill value\n* @param {string} [dtype] - data type\n* @throws {TypeError} first argument must be an array or typed array\n* @throws {TypeError} third argument must be a recognized data type\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0, 'float32' );\n* // returns <Float32Array>[ 1.0, 1.0 ]\n*/\nfunction fullLike( x, value ) {\n\tvar dt;\n\tvar v;\n\n\tdt = dtype( x ); // delegate input argument validation to dtype resolution\n\tif ( dt === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be either an array, typed array, or complex typed array. Value: `%s`.', x ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tdt = arguments[ 2 ];\n\t}\n\tif ( typeof value === 'number' ) {\n\t\tif ( dt === 'complex128' ) {\n\t\t\tv = new Complex128( value, 0.0 );\n\t\t} else if ( dt === 'complex64' ) {\n\t\t\tv = new Complex64( value, 0.0 );\n\t\t} else {\n\t\t\tv = value;\n\t\t}\n\t} else {\n\t\tv = value;\n\t}\n\treturn full( x.length, v, dt );\n}\n\n\n// EXPORTS //\n\nmodule.exports = fullLike;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create a filled array having the same length and data type as a provided input array.\n*\n* @module @stdlib/array-full-like\n*\n* @example\n* var fullLike = require( '@stdlib/array-full-like' );\n*\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var fullLike = require( '@stdlib/array-full-like' );\n*\n* var arr = fullLike( [ 0.0, 0.0 ], 1.0, 'float32' );\n* // returns <Float32Array>[ 1.0, 1.0 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,qBAAsB,EACvCC,EAAO,QAAS,oBAAqB,EACrCC,EAAa,QAAS,8BAA+B,EACrDC,EAAY,QAAS,8BAA+B,EAuBxD,SAASC,EAAUC,EAAGC,EAAQ,CAC7B,IAAIC,EACAC,EAGJ,GADAD,EAAKP,EAAOK,CAAE,EACTE,IAAO,KACX,MAAM,IAAI,UAAWR,EAAQ,8GAA+GM,CAAE,CAAE,EAEjJ,OAAK,UAAU,OAAS,IACvBE,EAAK,UAAW,CAAE,GAEd,OAAOD,GAAU,SAChBC,IAAO,aACXC,EAAI,IAAIN,EAAYI,EAAO,CAAI,EACpBC,IAAO,YAClBC,EAAI,IAAIL,EAAWG,EAAO,CAAI,EAE9BE,EAAIF,EAGLE,EAAIF,EAEEL,EAAMI,EAAE,OAAQG,EAAGD,CAAG,CAC9B,CAKAT,EAAO,QAAUM,ICrCjB,IAAIK,EAAO,IAKX,OAAO,QAAUA",
|
|
6
6
|
"names": ["require_main", "__commonJSMin", "exports", "module", "format", "dtype", "full", "Complex128", "Complex64", "fullLike", "x", "value", "dt", "v", "main"]
|
|
7
7
|
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @license Apache-2.0
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2024 The Stdlib Authors.
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
23
|
-
import { Complex128Array, Complex64Array, AnyArray, DataType } from '@stdlib/types/array';
|
|
23
|
+
import { Complex128Array, Complex64Array, BooleanArray, AnyArray, DataType } from '@stdlib/types/array';
|
|
24
24
|
import { ComplexLike } from '@stdlib/types/complex';
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -61,6 +61,25 @@ declare function fullLike( x: AnyArray, value: number, dtype: 'float64' ): Float
|
|
|
61
61
|
*/
|
|
62
62
|
declare function fullLike( x: AnyArray, value: number, dtype: 'float32' ): Float32Array;
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Creates a filled array having the same length as a provided input array.
|
|
66
|
+
*
|
|
67
|
+
* @param x - input array from which to derive the output array length
|
|
68
|
+
* @param value - fill value
|
|
69
|
+
* @param dtype - data type
|
|
70
|
+
* @returns filled array
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* var zeros = require( '@stdlib/array-zeros' );
|
|
74
|
+
*
|
|
75
|
+
* var x = zeros( 2, 'uint8' );
|
|
76
|
+
* // returns <Uint8Array>[ 0, 0 ]
|
|
77
|
+
*
|
|
78
|
+
* var y = fullLike( x, true, 'bool' );
|
|
79
|
+
* // returns <BooleanArray>[ true, true ]
|
|
80
|
+
*/
|
|
81
|
+
declare function fullLike( x: AnyArray, value: boolean, dtype: 'bool' ): BooleanArray;
|
|
82
|
+
|
|
64
83
|
/**
|
|
65
84
|
* Creates a filled array having the same length as a provided input array.
|
|
66
85
|
*
|
|
@@ -262,21 +281,6 @@ declare function fullLike( x: AnyArray, value: any, dtype: 'generic' ): Array<an
|
|
|
262
281
|
/**
|
|
263
282
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
264
283
|
*
|
|
265
|
-
* The function supports the following data types:
|
|
266
|
-
*
|
|
267
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
268
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
269
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
270
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
271
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
272
|
-
* - `uint32`: 32-bit unsigned integers
|
|
273
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
274
|
-
* - `uint16`: 16-bit unsigned integers
|
|
275
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
276
|
-
* - `uint8`: 8-bit unsigned integers
|
|
277
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
278
|
-
* - `generic`: generic JavaScript values
|
|
279
|
-
*
|
|
280
284
|
* @param x - input array from which to derive the output array length
|
|
281
285
|
* @param value - fill value
|
|
282
286
|
* @param dtype - data type
|
|
@@ -296,21 +300,6 @@ declare function fullLike( x: Float64Array, value: number, dtype?: DataType ): F
|
|
|
296
300
|
/**
|
|
297
301
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
298
302
|
*
|
|
299
|
-
* The function supports the following data types:
|
|
300
|
-
*
|
|
301
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
302
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
303
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
304
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
305
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
306
|
-
* - `uint32`: 32-bit unsigned integers
|
|
307
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
308
|
-
* - `uint16`: 16-bit unsigned integers
|
|
309
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
310
|
-
* - `uint8`: 8-bit unsigned integers
|
|
311
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
312
|
-
* - `generic`: generic JavaScript values
|
|
313
|
-
*
|
|
314
303
|
* @param x - input array from which to derive the output array length
|
|
315
304
|
* @param value - fill value
|
|
316
305
|
* @param dtype - data type
|
|
@@ -330,20 +319,24 @@ declare function fullLike( x: Float32Array, value: number, dtype?: DataType ): F
|
|
|
330
319
|
/**
|
|
331
320
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
332
321
|
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
|
|
322
|
+
* @param x - input array from which to derive the output array length
|
|
323
|
+
* @param value - fill value
|
|
324
|
+
* @param dtype - data type
|
|
325
|
+
* @returns filled array
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* var zeros = require( '@stdlib/array-zeros' );
|
|
329
|
+
*
|
|
330
|
+
* var x = zeros( 2, 'bool' );
|
|
331
|
+
* // returns <BooleanArray>[ false, false ]
|
|
332
|
+
*
|
|
333
|
+
* var y = fullLike( x, true );
|
|
334
|
+
* // returns <BooleanArray>[ true, true ]
|
|
335
|
+
*/
|
|
336
|
+
declare function fullLike( x: BooleanArray, value: boolean, dtype?: DataType ): BooleanArray;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Creates a filled array having the same length and data type as a provided input array.
|
|
347
340
|
*
|
|
348
341
|
* ## Notes
|
|
349
342
|
*
|
|
@@ -368,21 +361,6 @@ declare function fullLike( x: Complex128Array, value: number | ComplexLike, dtyp
|
|
|
368
361
|
/**
|
|
369
362
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
370
363
|
*
|
|
371
|
-
* The function supports the following data types:
|
|
372
|
-
*
|
|
373
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
374
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
375
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
376
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
377
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
378
|
-
* - `uint32`: 32-bit unsigned integers
|
|
379
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
380
|
-
* - `uint16`: 16-bit unsigned integers
|
|
381
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
382
|
-
* - `uint8`: 8-bit unsigned integers
|
|
383
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
384
|
-
* - `generic`: generic JavaScript values
|
|
385
|
-
*
|
|
386
364
|
* ## Notes
|
|
387
365
|
*
|
|
388
366
|
* - If provided a number, the function returns a complex number array where each element has a real component whose value equals the provided fill value and where each element has an imaginary component equal to `0`.
|
|
@@ -406,21 +384,6 @@ declare function fullLike( x: Complex64Array, value: number | ComplexLike, dtype
|
|
|
406
384
|
/**
|
|
407
385
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
408
386
|
*
|
|
409
|
-
* The function supports the following data types:
|
|
410
|
-
*
|
|
411
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
412
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
413
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
414
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
415
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
416
|
-
* - `uint32`: 32-bit unsigned integers
|
|
417
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
418
|
-
* - `uint16`: 16-bit unsigned integers
|
|
419
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
420
|
-
* - `uint8`: 8-bit unsigned integers
|
|
421
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
422
|
-
* - `generic`: generic JavaScript values
|
|
423
|
-
*
|
|
424
387
|
* @param x - input array from which to derive the output array length
|
|
425
388
|
* @param value - fill value
|
|
426
389
|
* @param dtype - data type
|
|
@@ -440,21 +403,6 @@ declare function fullLike( x: Int32Array, value: number, dtype?: DataType ): Int
|
|
|
440
403
|
/**
|
|
441
404
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
442
405
|
*
|
|
443
|
-
* The function supports the following data types:
|
|
444
|
-
*
|
|
445
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
446
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
447
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
448
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
449
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
450
|
-
* - `uint32`: 32-bit unsigned integers
|
|
451
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
452
|
-
* - `uint16`: 16-bit unsigned integers
|
|
453
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
454
|
-
* - `uint8`: 8-bit unsigned integers
|
|
455
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
456
|
-
* - `generic`: generic JavaScript values
|
|
457
|
-
*
|
|
458
406
|
* @param x - input array from which to derive the output array length
|
|
459
407
|
* @param value - fill value
|
|
460
408
|
* @param dtype - data type
|
|
@@ -474,21 +422,6 @@ declare function fullLike( x: Int16Array, value: number, dtype?: DataType ): Int
|
|
|
474
422
|
/**
|
|
475
423
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
476
424
|
*
|
|
477
|
-
* The function supports the following data types:
|
|
478
|
-
*
|
|
479
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
480
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
481
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
482
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
483
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
484
|
-
* - `uint32`: 32-bit unsigned integers
|
|
485
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
486
|
-
* - `uint16`: 16-bit unsigned integers
|
|
487
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
488
|
-
* - `uint8`: 8-bit unsigned integers
|
|
489
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
490
|
-
* - `generic`: generic JavaScript values
|
|
491
|
-
*
|
|
492
425
|
* @param x - input array from which to derive the output array length
|
|
493
426
|
* @param value - fill value
|
|
494
427
|
* @param dtype - data type
|
|
@@ -508,21 +441,6 @@ declare function fullLike( x: Int8Array, value: number, dtype?: DataType ): Int8
|
|
|
508
441
|
/**
|
|
509
442
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
510
443
|
*
|
|
511
|
-
* The function supports the following data types:
|
|
512
|
-
*
|
|
513
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
514
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
515
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
516
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
517
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
518
|
-
* - `uint32`: 32-bit unsigned integers
|
|
519
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
520
|
-
* - `uint16`: 16-bit unsigned integers
|
|
521
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
522
|
-
* - `uint8`: 8-bit unsigned integers
|
|
523
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
524
|
-
* - `generic`: generic JavaScript values
|
|
525
|
-
*
|
|
526
444
|
* @param x - input array from which to derive the output array length
|
|
527
445
|
* @param value - fill value
|
|
528
446
|
* @param dtype - data type
|
|
@@ -542,21 +460,6 @@ declare function fullLike( x: Uint32Array, value: number, dtype?: DataType ): Ui
|
|
|
542
460
|
/**
|
|
543
461
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
544
462
|
*
|
|
545
|
-
* The function supports the following data types:
|
|
546
|
-
*
|
|
547
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
548
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
549
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
550
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
551
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
552
|
-
* - `uint32`: 32-bit unsigned integers
|
|
553
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
554
|
-
* - `uint16`: 16-bit unsigned integers
|
|
555
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
556
|
-
* - `uint8`: 8-bit unsigned integers
|
|
557
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
558
|
-
* - `generic`: generic JavaScript values
|
|
559
|
-
*
|
|
560
463
|
* @param x - input array from which to derive the output array length
|
|
561
464
|
* @param value - fill value
|
|
562
465
|
* @param dtype - data type
|
|
@@ -576,21 +479,6 @@ declare function fullLike( x: Uint16Array, value: number, dtype?: DataType ): Ui
|
|
|
576
479
|
/**
|
|
577
480
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
578
481
|
*
|
|
579
|
-
* The function supports the following data types:
|
|
580
|
-
*
|
|
581
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
582
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
583
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
584
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
585
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
586
|
-
* - `uint32`: 32-bit unsigned integers
|
|
587
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
588
|
-
* - `uint16`: 16-bit unsigned integers
|
|
589
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
590
|
-
* - `uint8`: 8-bit unsigned integers
|
|
591
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
592
|
-
* - `generic`: generic JavaScript values
|
|
593
|
-
*
|
|
594
482
|
* @param x - input array from which to derive the output array length
|
|
595
483
|
* @param value - fill value
|
|
596
484
|
* @param dtype - data type
|
|
@@ -610,21 +498,6 @@ declare function fullLike( x: Uint8Array, value: number, dtype?: DataType ): Uin
|
|
|
610
498
|
/**
|
|
611
499
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
612
500
|
*
|
|
613
|
-
* The function supports the following data types:
|
|
614
|
-
*
|
|
615
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
616
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
617
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
618
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
619
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
620
|
-
* - `uint32`: 32-bit unsigned integers
|
|
621
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
622
|
-
* - `uint16`: 16-bit unsigned integers
|
|
623
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
624
|
-
* - `uint8`: 8-bit unsigned integers
|
|
625
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
626
|
-
* - `generic`: generic JavaScript values
|
|
627
|
-
*
|
|
628
501
|
* @param x - input array from which to derive the output array length
|
|
629
502
|
* @param value - fill value
|
|
630
503
|
* @param dtype - data type
|
|
@@ -644,21 +517,6 @@ declare function fullLike( x: Uint8ClampedArray, value: number, dtype?: DataType
|
|
|
644
517
|
/**
|
|
645
518
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
646
519
|
*
|
|
647
|
-
* The function supports the following data types:
|
|
648
|
-
*
|
|
649
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
650
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
651
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
652
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
653
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
654
|
-
* - `uint32`: 32-bit unsigned integers
|
|
655
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
656
|
-
* - `uint16`: 16-bit unsigned integers
|
|
657
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
658
|
-
* - `uint8`: 8-bit unsigned integers
|
|
659
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
660
|
-
* - `generic`: generic JavaScript values
|
|
661
|
-
*
|
|
662
520
|
* @param x - input array from which to derive the output array length
|
|
663
521
|
* @param value - fill value
|
|
664
522
|
* @param dtype - data type
|
|
@@ -678,21 +536,6 @@ declare function fullLike( x: Array<any>, value: any, dtype?: DataType ): Array<
|
|
|
678
536
|
/**
|
|
679
537
|
* Creates a filled array having the same length and data type as a provided input array.
|
|
680
538
|
*
|
|
681
|
-
* The function supports the following data types:
|
|
682
|
-
*
|
|
683
|
-
* - `float64`: double-precision floating-point numbers (IEEE 754)
|
|
684
|
-
* - `float32`: single-precision floating-point numbers (IEEE 754)
|
|
685
|
-
* - `complex128`: double-precision complex floating-point numbers
|
|
686
|
-
* - `complex64`: single-precision complex floating-point numbers
|
|
687
|
-
* - `int32`: 32-bit two's complement signed integers
|
|
688
|
-
* - `uint32`: 32-bit unsigned integers
|
|
689
|
-
* - `int16`: 16-bit two's complement signed integers
|
|
690
|
-
* - `uint16`: 16-bit unsigned integers
|
|
691
|
-
* - `int8`: 8-bit two's complement signed integers
|
|
692
|
-
* - `uint8`: 8-bit unsigned integers
|
|
693
|
-
* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
|
|
694
|
-
* - `generic`: generic JavaScript values
|
|
695
|
-
*
|
|
696
539
|
* @param x - input array from which to derive the output array length
|
|
697
540
|
* @param value - fill value
|
|
698
541
|
* @param dtype - data type
|
package/lib/main.js
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
var format = require( '@stdlib/string-format' );
|
|
24
24
|
var dtype = require( '@stdlib/array-dtype' );
|
|
25
25
|
var full = require( '@stdlib/array-full' );
|
|
26
|
-
var Complex128 = require( '@stdlib/complex-float64' );
|
|
27
|
-
var Complex64 = require( '@stdlib/complex-float32' );
|
|
26
|
+
var Complex128 = require( '@stdlib/complex-float64-ctor' );
|
|
27
|
+
var Complex64 = require( '@stdlib/complex-float32-ctor' );
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
// MAIN //
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-full-like",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Create a filled array having the same length and data type as a provided array.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@stdlib/array-dtype": "^0.
|
|
33
|
+
"@stdlib/array-dtype": "^0.3.0",
|
|
34
34
|
"@stdlib/array-full": "^0.2.1",
|
|
35
|
-
"@stdlib/complex-float32": "^0.
|
|
36
|
-
"@stdlib/complex-float64": "^0.
|
|
37
|
-
"@stdlib/string-format": "^0.2.
|
|
38
|
-
"@stdlib/error-tools-fmtprodmsg": "^0.2.
|
|
35
|
+
"@stdlib/complex-float32-ctor": "^0.1.0",
|
|
36
|
+
"@stdlib/complex-float64-ctor": "^0.1.0",
|
|
37
|
+
"@stdlib/string-format": "^0.2.2",
|
|
38
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {},
|
|
41
41
|
"engines": {
|