Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Feb 22, 2024
1 parent 256b31c commit ea41a78
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/npm_downloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ jobs:
# Upload the download data:
- name: 'Upload data'
# Pin action to full length commit SHA corresponding to v3.1.3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
# Pin action to full length commit SHA
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
# Define a name for the uploaded artifact (ensuring a unique name for each job):
name: npm_downloads
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,10 @@ jobs:
mv ./package.json.tmp ./package.json
fi
done
jq -r '.devDependencies | keys[]' ./package.json | while read -r dep; do
if [[ "$dep" != "@stdlib"* ]]; then
continue
fi
dep=$(echo "$dep" | xargs)
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
mv ./package.json.tmp ./package.json
fi
done
# Set `devDependencies` to an empty object:
jq --indent 2 '.devDependencies = {}' ./package.json > ./package.json.tmp
mv ./package.json.tmp ./package.json
# Remove CLI section:
find . -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?<section class=\"cli\">[\s\S]+?<\!\-\- \/.cli \-\->//"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ jobs:

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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-filled.svg
[npm-url]: https://npmjs.org/package/@stdlib/array-filled

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

[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-filled/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/array-filled?branch=main
Expand Down
23 changes: 10 additions & 13 deletions docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/unified-signatures */

// TypeScript Version: 4.1

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

import { RealOrComplexTypedArray, DataType, Collection } from '@stdlib/types/array';
import { Collection, DataTypeMap } from '@stdlib/types/array';
import { IterableIterator } from '@stdlib/types/iter';

/**
* Array or typed array.
*/
type ArrayOrTypedArray = Array<any> | RealOrComplexTypedArray;

/**
* Creates a filled array.
*
Expand Down Expand Up @@ -57,7 +54,7 @@ type ArrayOrTypedArray = Array<any> | RealOrComplexTypedArray;
* var arr = filledarray( 'float32' );
* // returns <Float32Array>
*/
declare function filledarray( dtype?: DataType ): ArrayOrTypedArray;
declare function filledarray<T = any, U extends keyof DataTypeMap<T> = 'float64'>( dtype?: U ): DataTypeMap<any>[U];

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

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

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

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

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

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


// EXPORTS //
Expand Down
55 changes: 27 additions & 28 deletions docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,64 +21,63 @@
import { IterableIterator } from '@stdlib/types/iter';
import filledarray = require( './index' );


/**
* Returns an iterator protocol-compliant object.
* Implements the iterator protocol `next` method.
*
* @returns iterator protocol-compliant object
*/
function iterator(): IterableIterator {
const obj: IterableIterator = {
[Symbol.iterator]: iterator,
'next': next
function next(): any {
return {
'value': 1.0,
'done': false
};
return obj;
}

/**
* Implements the iterator protocol `next` method.
* Returns an iterator protocol-compliant object.
*
* @returns iterator protocol-compliant object
*/
function next(): any {
return {
'value': 1.0,
'done': false
function iterator(): IterableIterator {
const obj: IterableIterator = {
[Symbol.iterator]: iterator,
'next': next
};
return obj;
}


// TESTS //

// The function returns an array or typed array...
{
filledarray(); // $ExpectType ArrayOrTypedArray
filledarray( 'float32' ); // $ExpectType ArrayOrTypedArray
filledarray(); // $ExpectType Float64Array
filledarray( 'float32' ); // $ExpectType Float32Array

filledarray( 1.0, 10 ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, 10, 'int32' ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, 10 ); // $ExpectType Float64Array
filledarray( 1.0, 10, 'int32' ); // $ExpectType Int32Array

const x = new Float64Array( 10 );
filledarray( 1.0, x ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, x, 'uint8' ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, x ); // $ExpectType Float64Array
filledarray( 1.0, x, 'uint8' ); // $ExpectType Uint8Array

const y = [ 2.0, 2.0, 2.0 ];
filledarray( 1.0, y ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, y, 'float64' ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, y ); // $ExpectType Float64Array
filledarray( 1.0, y, 'float64' ); // $ExpectType Float64Array

const it = iterator();
filledarray( 1.0, it ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, it, 'uint8c' ); // $ExpectType ArrayOrTypedArray
filledarray( 1.0, it ); // $ExpectType Float64Array
filledarray( 1.0, it, 'uint8c' ); // $ExpectType Uint8ClampedArray

const buf = new ArrayBuffer( 32 );
filledarray( 1.0, buf ); // $ExpectType RealOrComplexTypedArray
filledarray( 1.0, buf, 'uint32' ); // $ExpectType RealOrComplexTypedArray
filledarray( 1.0, buf ); // $ExpectType Float64Array
filledarray( 1.0, buf, 'uint32' ); // $ExpectType Uint32Array

filledarray( 1.0, buf, 8 ); // $ExpectType RealOrComplexTypedArray
filledarray( 1.0, buf, 8, 'uint16' ); // $ExpectType RealOrComplexTypedArray
filledarray( 1.0, buf, 8 ); // $ExpectType Float64Array
filledarray( 1.0, buf, 8, 'uint16' ); // $ExpectType Uint16Array

filledarray( 1.0, buf, 8, 2 ); // $ExpectType RealOrComplexTypedArray
filledarray( 1.0, buf, 8, 2, 'int16' ); // $ExpectType RealOrComplexTypedArray
filledarray( 1.0, buf, 8, 2 ); // $ExpectType Float64Array
filledarray( 1.0, buf, 8, 2, 'int16' ); // $ExpectType Int16Array
}

// The compiler throws an error if the function is not provided a valid length, typed array, array-like object, `ArrayBuffer`, or iterable argument...
Expand Down
48 changes: 24 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,43 @@
"@stdlib/array-base-filled": "^0.2.0",
"@stdlib/array-ctors": "^0.2.0",
"@stdlib/array-defaults": "^0.2.0",
"@stdlib/assert-has-iterator-symbol-support": "^0.2.0",
"@stdlib/assert-is-arraybuffer": "^0.2.0",
"@stdlib/assert-has-iterator-symbol-support": "^0.2.1",
"@stdlib/assert-is-arraybuffer": "^0.2.1",
"@stdlib/assert-is-collection": "^0.2.0",
"@stdlib/assert-is-function": "^0.2.0",
"@stdlib/assert-is-function": "^0.2.1",
"@stdlib/assert-is-nonnegative-integer": "^0.2.0",
"@stdlib/assert-is-object": "^0.2.0",
"@stdlib/assert-is-string": "^0.2.0",
"@stdlib/assert-is-object": "^0.2.1",
"@stdlib/assert-is-string": "^0.2.1",
"@stdlib/blas-ext-base-gfill": "^0.2.0",
"@stdlib/iter-length": "^0.2.0",
"@stdlib/string-format": "^0.2.0",
"@stdlib/symbol-iterator": "^0.2.0",
"@stdlib/types": "^0.3.1"
"@stdlib/iter-length": "^0.2.1",
"@stdlib/string-format": "^0.2.1",
"@stdlib/symbol-iterator": "^0.2.1",
"@stdlib/types": "^0.3.2"
},
"devDependencies": {
"@stdlib/array-buffer": "^0.2.0",
"@stdlib/array-complex128": "^0.1.0",
"@stdlib/array-complex64": "^0.1.0",
"@stdlib/array-float32": "^0.2.0",
"@stdlib/array-float64": "^0.2.0",
"@stdlib/array-int16": "^0.2.0",
"@stdlib/array-int32": "^0.2.0",
"@stdlib/array-int8": "^0.2.0",
"@stdlib/array-complex128": "^0.2.0",
"@stdlib/array-complex64": "^0.2.0",
"@stdlib/array-float32": "^0.2.1",
"@stdlib/array-float64": "^0.2.1",
"@stdlib/array-int16": "^0.2.1",
"@stdlib/array-int32": "^0.2.1",
"@stdlib/array-int8": "^0.2.1",
"@stdlib/array-typed-real-dtypes": "^0.2.0",
"@stdlib/array-uint16": "^0.2.0",
"@stdlib/array-uint32": "^0.2.0",
"@stdlib/array-uint8": "^0.2.0",
"@stdlib/array-uint8c": "^0.2.0",
"@stdlib/assert-instance-of": "^0.2.0",
"@stdlib/assert-is-array": "^0.2.0",
"@stdlib/array-uint16": "^0.2.1",
"@stdlib/array-uint32": "^0.2.1",
"@stdlib/array-uint8": "^0.2.1",
"@stdlib/array-uint8c": "^0.2.1",
"@stdlib/assert-instance-of": "^0.2.1",
"@stdlib/assert-is-array": "^0.2.1",
"@stdlib/assert-is-typed-array": "^0.2.0",
"@stdlib/assert-is-typed-array-like": "^0.2.0",
"@stdlib/complex-float32": "^0.2.0",
"@stdlib/complex-float64": "^0.2.0",
"@stdlib/iter-constant": "^0.2.0",
"@stdlib/math-base-special-pow": "^0.2.0",
"@stdlib/random-base-discrete-uniform": "^0.1.0",
"@stdlib/strided-base-reinterpret-complex128": "^0.2.0",
"@stdlib/random-base-discrete-uniform": "^0.2.0",
"@stdlib/strided-base-reinterpret-complex128": "^0.2.1",
"@stdlib/strided-base-reinterpret-complex64": "^0.2.0",
"proxyquire": "^2.0.0",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
Expand Down

0 comments on commit ea41a78

Please sign in to comment.