Skip to content

Commit ea41a78

Browse files
committed
Auto-generated commit
1 parent 256b31c commit ea41a78

File tree

7 files changed

+71
-81
lines changed

7 files changed

+71
-81
lines changed

.github/workflows/npm_downloads.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ jobs:
8686
8787
# Upload the download data:
8888
- name: 'Upload data'
89-
# Pin action to full length commit SHA corresponding to v3.1.3
90-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
89+
# Pin action to full length commit SHA
90+
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
9191
with:
9292
# Define a name for the uploaded artifact (ensuring a unique name for each job):
9393
name: npm_downloads

.github/workflows/publish.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,10 @@ jobs:
124124
mv ./package.json.tmp ./package.json
125125
fi
126126
done
127-
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
128-
if [[ "$dep" != "@stdlib"* ]]; then
129-
continue
130-
fi
131-
dep=$(echo "$dep" | xargs)
132-
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
133-
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
134-
mv ./package.json.tmp ./package.json
135-
fi
136-
done
127+
128+
# Set `devDependencies` to an empty object:
129+
jq --indent 2 '.devDependencies = {}' ./package.json > ./package.json.tmp
130+
mv ./package.json.tmp ./package.json
137131
138132
# Remove CLI section:
139133
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"

.github/workflows/test_bundles.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ jobs:
168168

169169
# Install Deno:
170170
- name: 'Install Deno'
171-
# Pin action to full length commit SHA corresponding to v1.1.2
172-
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31
171+
# Pin action to full length commit SHA
172+
uses: denoland/setup-deno@041b854f97b325bd60e53e9dc2de9cb9f9ac0cba # v1.1.4
173173
with:
174174
deno-version: vx.x.x
175175

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
297297
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-filled.svg
298298
[npm-url]: https://npmjs.org/package/@stdlib/array-filled
299299

300-
[test-image]: https://github.com/stdlib-js/array-filled/actions/workflows/test.yml/badge.svg?branch=v0.2.0
301-
[test-url]: https://github.com/stdlib-js/array-filled/actions/workflows/test.yml?query=branch:v0.2.0
300+
[test-image]: https://github.com/stdlib-js/array-filled/actions/workflows/test.yml/badge.svg?branch=main
301+
[test-url]: https://github.com/stdlib-js/array-filled/actions/workflows/test.yml?query=branch:main
302302

303303
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-filled/main.svg
304304
[coverage-url]: https://codecov.io/github/stdlib-js/array-filled?branch=main

docs/types/index.d.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@
1616
* limitations under the License.
1717
*/
1818

19+
/* eslint-disable @typescript-eslint/unified-signatures */
20+
1921
// TypeScript Version: 4.1
2022

2123
/// <reference types="@stdlib/types"/>
2224

23-
import { RealOrComplexTypedArray, DataType, Collection } from '@stdlib/types/array';
25+
import { Collection, DataTypeMap } from '@stdlib/types/array';
2426
import { IterableIterator } from '@stdlib/types/iter';
2527

26-
/**
27-
* Array or typed array.
28-
*/
29-
type ArrayOrTypedArray = Array<any> | RealOrComplexTypedArray;
30-
3128
/**
3229
* Creates a filled array.
3330
*
@@ -57,7 +54,7 @@ type ArrayOrTypedArray = Array<any> | RealOrComplexTypedArray;
5754
* var arr = filledarray( 'float32' );
5855
* // returns <Float32Array>
5956
*/
60-
declare function filledarray( dtype?: DataType ): ArrayOrTypedArray;
57+
declare function filledarray<T = any, U extends keyof DataTypeMap<T> = 'float64'>( dtype?: U ): DataTypeMap<any>[U];
6158

6259
/**
6360
* Creates a filled array having a specified `length`.
@@ -75,7 +72,7 @@ declare function filledarray( dtype?: DataType ): ArrayOrTypedArray;
7572
* var arr = filledarray( 1.0, 5, 'float32' );
7673
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
7774
*/
78-
declare function filledarray( value: any, length: number, dtype?: DataType ): ArrayOrTypedArray;
75+
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, length: number, dtype?: U ): DataTypeMap<T>[U];
7976

8077
/**
8178
* Creates a filled array from another `array`.
@@ -93,7 +90,7 @@ declare function filledarray( value: any, length: number, dtype?: DataType ): Ar
9390
* var arr = filledarray( 1.0, [ 5.0, -3.0, 2.0 ], 'float32' );
9491
* // returns <Float32Array>[ 1.0, 1.0, 1.0 ]
9592
*/
96-
declare function filledarray( value: any, array: Collection, dtype?: DataType ): ArrayOrTypedArray;
93+
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, array: Collection, dtype?: U ): DataTypeMap<T>[U];
9794

9895
/**
9996
* Creates a filled array from an iterable.
@@ -121,7 +118,7 @@ declare function filledarray( value: any, array: Collection, dtype?: DataType ):
121118
* var arr = filledarray( 1.0, it, 'float32' );
122119
* // returns <Float32Array>[ 1.0, 1.0, 1.0 ]
123120
*/
124-
declare function filledarray( value: any, iterable: IterableIterator, dtype?: DataType ): ArrayOrTypedArray;
121+
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, iterable: IterableIterator, dtype?: U ): DataTypeMap<T>[U];
125122

126123
/**
127124
* Returns a filled typed array view of an `ArrayBuffer`.
@@ -151,7 +148,7 @@ declare function filledarray( value: any, iterable: IterableIterator, dtype?: Da
151148
* var arr = filledarray( 1.0, buf, 8, 2, 'float32' );
152149
* // returns <Float32Array>[ 1.0, 1.0 ]
153150
*/
154-
declare function filledarray( value: any, buffer: ArrayBuffer, byteOffset: number, length: number, dtype?: DataType ): RealOrComplexTypedArray;
151+
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, buffer: ArrayBuffer, byteOffset: number, length: number, dtype?: U ): DataTypeMap<T>[U];
155152

156153
/**
157154
* Returns a filled typed array view of an `ArrayBuffer`.
@@ -180,7 +177,7 @@ declare function filledarray( value: any, buffer: ArrayBuffer, byteOffset: numbe
180177
* var arr = filledarray( 1.0, buf, 8, 'float32' );
181178
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
182179
*/
183-
declare function filledarray( value: any, buffer: ArrayBuffer, byteOffset: number, dtype?: DataType ): RealOrComplexTypedArray;
180+
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, buffer: ArrayBuffer, byteOffset: number, dtype?: U ): DataTypeMap<T>[U];
184181

185182
/**
186183
* Returns a filled typed array view of an `ArrayBuffer`.
@@ -208,7 +205,7 @@ declare function filledarray( value: any, buffer: ArrayBuffer, byteOffset: numbe
208205
* var arr = filledarray( 1.0, buf, 'float32' );
209206
* // returns <Float32Array>[ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ]
210207
*/
211-
declare function filledarray( value: any, buffer: ArrayBuffer, dtype?: DataType ): RealOrComplexTypedArray;
208+
declare function filledarray<T, U extends keyof DataTypeMap<T> = 'float64'>( value: T, buffer: ArrayBuffer, dtype?: U ): DataTypeMap<T>[U];
212209

213210

214211
// EXPORTS //

docs/types/test.ts

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,64 +21,63 @@
2121
import { IterableIterator } from '@stdlib/types/iter';
2222
import filledarray = require( './index' );
2323

24-
2524
/**
26-
* Returns an iterator protocol-compliant object.
25+
* Implements the iterator protocol `next` method.
2726
*
2827
* @returns iterator protocol-compliant object
2928
*/
30-
function iterator(): IterableIterator {
31-
const obj: IterableIterator = {
32-
[Symbol.iterator]: iterator,
33-
'next': next
29+
function next(): any {
30+
return {
31+
'value': 1.0,
32+
'done': false
3433
};
35-
return obj;
3634
}
3735

3836
/**
39-
* Implements the iterator protocol `next` method.
37+
* Returns an iterator protocol-compliant object.
4038
*
4139
* @returns iterator protocol-compliant object
4240
*/
43-
function next(): any {
44-
return {
45-
'value': 1.0,
46-
'done': false
41+
function iterator(): IterableIterator {
42+
const obj: IterableIterator = {
43+
[Symbol.iterator]: iterator,
44+
'next': next
4745
};
46+
return obj;
4847
}
4948

5049

5150
// TESTS //
5251

5352
// The function returns an array or typed array...
5453
{
55-
filledarray(); // $ExpectType ArrayOrTypedArray
56-
filledarray( 'float32' ); // $ExpectType ArrayOrTypedArray
54+
filledarray(); // $ExpectType Float64Array
55+
filledarray( 'float32' ); // $ExpectType Float32Array
5756

58-
filledarray( 1.0, 10 ); // $ExpectType ArrayOrTypedArray
59-
filledarray( 1.0, 10, 'int32' ); // $ExpectType ArrayOrTypedArray
57+
filledarray( 1.0, 10 ); // $ExpectType Float64Array
58+
filledarray( 1.0, 10, 'int32' ); // $ExpectType Int32Array
6059

6160
const x = new Float64Array( 10 );
62-
filledarray( 1.0, x ); // $ExpectType ArrayOrTypedArray
63-
filledarray( 1.0, x, 'uint8' ); // $ExpectType ArrayOrTypedArray
61+
filledarray( 1.0, x ); // $ExpectType Float64Array
62+
filledarray( 1.0, x, 'uint8' ); // $ExpectType Uint8Array
6463

6564
const y = [ 2.0, 2.0, 2.0 ];
66-
filledarray( 1.0, y ); // $ExpectType ArrayOrTypedArray
67-
filledarray( 1.0, y, 'float64' ); // $ExpectType ArrayOrTypedArray
65+
filledarray( 1.0, y ); // $ExpectType Float64Array
66+
filledarray( 1.0, y, 'float64' ); // $ExpectType Float64Array
6867

6968
const it = iterator();
70-
filledarray( 1.0, it ); // $ExpectType ArrayOrTypedArray
71-
filledarray( 1.0, it, 'uint8c' ); // $ExpectType ArrayOrTypedArray
69+
filledarray( 1.0, it ); // $ExpectType Float64Array
70+
filledarray( 1.0, it, 'uint8c' ); // $ExpectType Uint8ClampedArray
7271

7372
const buf = new ArrayBuffer( 32 );
74-
filledarray( 1.0, buf ); // $ExpectType RealOrComplexTypedArray
75-
filledarray( 1.0, buf, 'uint32' ); // $ExpectType RealOrComplexTypedArray
73+
filledarray( 1.0, buf ); // $ExpectType Float64Array
74+
filledarray( 1.0, buf, 'uint32' ); // $ExpectType Uint32Array
7675

77-
filledarray( 1.0, buf, 8 ); // $ExpectType RealOrComplexTypedArray
78-
filledarray( 1.0, buf, 8, 'uint16' ); // $ExpectType RealOrComplexTypedArray
76+
filledarray( 1.0, buf, 8 ); // $ExpectType Float64Array
77+
filledarray( 1.0, buf, 8, 'uint16' ); // $ExpectType Uint16Array
7978

80-
filledarray( 1.0, buf, 8, 2 ); // $ExpectType RealOrComplexTypedArray
81-
filledarray( 1.0, buf, 8, 2, 'int16' ); // $ExpectType RealOrComplexTypedArray
79+
filledarray( 1.0, buf, 8, 2 ); // $ExpectType Float64Array
80+
filledarray( 1.0, buf, 8, 2, 'int16' ); // $ExpectType Int16Array
8281
}
8382

8483
// The compiler throws an error if the function is not provided a valid length, typed array, array-like object, `ArrayBuffer`, or iterable argument...

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,43 +40,43 @@
4040
"@stdlib/array-base-filled": "^0.2.0",
4141
"@stdlib/array-ctors": "^0.2.0",
4242
"@stdlib/array-defaults": "^0.2.0",
43-
"@stdlib/assert-has-iterator-symbol-support": "^0.2.0",
44-
"@stdlib/assert-is-arraybuffer": "^0.2.0",
43+
"@stdlib/assert-has-iterator-symbol-support": "^0.2.1",
44+
"@stdlib/assert-is-arraybuffer": "^0.2.1",
4545
"@stdlib/assert-is-collection": "^0.2.0",
46-
"@stdlib/assert-is-function": "^0.2.0",
46+
"@stdlib/assert-is-function": "^0.2.1",
4747
"@stdlib/assert-is-nonnegative-integer": "^0.2.0",
48-
"@stdlib/assert-is-object": "^0.2.0",
49-
"@stdlib/assert-is-string": "^0.2.0",
48+
"@stdlib/assert-is-object": "^0.2.1",
49+
"@stdlib/assert-is-string": "^0.2.1",
5050
"@stdlib/blas-ext-base-gfill": "^0.2.0",
51-
"@stdlib/iter-length": "^0.2.0",
52-
"@stdlib/string-format": "^0.2.0",
53-
"@stdlib/symbol-iterator": "^0.2.0",
54-
"@stdlib/types": "^0.3.1"
51+
"@stdlib/iter-length": "^0.2.1",
52+
"@stdlib/string-format": "^0.2.1",
53+
"@stdlib/symbol-iterator": "^0.2.1",
54+
"@stdlib/types": "^0.3.2"
5555
},
5656
"devDependencies": {
5757
"@stdlib/array-buffer": "^0.2.0",
58-
"@stdlib/array-complex128": "^0.1.0",
59-
"@stdlib/array-complex64": "^0.1.0",
60-
"@stdlib/array-float32": "^0.2.0",
61-
"@stdlib/array-float64": "^0.2.0",
62-
"@stdlib/array-int16": "^0.2.0",
63-
"@stdlib/array-int32": "^0.2.0",
64-
"@stdlib/array-int8": "^0.2.0",
58+
"@stdlib/array-complex128": "^0.2.0",
59+
"@stdlib/array-complex64": "^0.2.0",
60+
"@stdlib/array-float32": "^0.2.1",
61+
"@stdlib/array-float64": "^0.2.1",
62+
"@stdlib/array-int16": "^0.2.1",
63+
"@stdlib/array-int32": "^0.2.1",
64+
"@stdlib/array-int8": "^0.2.1",
6565
"@stdlib/array-typed-real-dtypes": "^0.2.0",
66-
"@stdlib/array-uint16": "^0.2.0",
67-
"@stdlib/array-uint32": "^0.2.0",
68-
"@stdlib/array-uint8": "^0.2.0",
69-
"@stdlib/array-uint8c": "^0.2.0",
70-
"@stdlib/assert-instance-of": "^0.2.0",
71-
"@stdlib/assert-is-array": "^0.2.0",
66+
"@stdlib/array-uint16": "^0.2.1",
67+
"@stdlib/array-uint32": "^0.2.1",
68+
"@stdlib/array-uint8": "^0.2.1",
69+
"@stdlib/array-uint8c": "^0.2.1",
70+
"@stdlib/assert-instance-of": "^0.2.1",
71+
"@stdlib/assert-is-array": "^0.2.1",
7272
"@stdlib/assert-is-typed-array": "^0.2.0",
7373
"@stdlib/assert-is-typed-array-like": "^0.2.0",
7474
"@stdlib/complex-float32": "^0.2.0",
7575
"@stdlib/complex-float64": "^0.2.0",
7676
"@stdlib/iter-constant": "^0.2.0",
7777
"@stdlib/math-base-special-pow": "^0.2.0",
78-
"@stdlib/random-base-discrete-uniform": "^0.1.0",
79-
"@stdlib/strided-base-reinterpret-complex128": "^0.2.0",
78+
"@stdlib/random-base-discrete-uniform": "^0.2.0",
79+
"@stdlib/strided-base-reinterpret-complex128": "^0.2.1",
8080
"@stdlib/strided-base-reinterpret-complex64": "^0.2.0",
8181
"proxyquire": "^2.0.0",
8282
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",

0 commit comments

Comments
 (0)