Skip to content

Commit dbfa032

Browse files
committed
Auto-generated commit
1 parent 7399f7c commit dbfa032

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@
431431

432432
### Bug Fixes
433433

434+
- [`2848c77`](https://github.com/stdlib-js/stdlib/commit/2848c77bb0cf8fd2fc78fe72095a1aad2e545a36) - improve type specificity, remove unreachable path, and fix docs
434435
- [`5b491c9`](https://github.com/stdlib-js/stdlib/commit/5b491c98f454c2413c23eaa901543bef9e3642f2) - allow enums to be nonpositive integers
435436
- [`a278663`](https://github.com/stdlib-js/stdlib/commit/a2786634547c68e950444c8a16d522d2ab79e335) - ensure \"generic\" data type objects are considered valid
436437
- [`f8e5205`](https://github.com/stdlib-js/stdlib/commit/f8e520591bc2a8d8436ebb4fbe1604a7376105cd) - use correct `sliceAssign` alias
@@ -591,6 +592,7 @@ A total of 24 issues were closed in this release:
591592

592593
<details>
593594

595+
- [`2848c77`](https://github.com/stdlib-js/stdlib/commit/2848c77bb0cf8fd2fc78fe72095a1aad2e545a36) - **fix:** improve type specificity, remove unreachable path, and fix docs _(by Athan Reines)_
594596
- [`b5a916e`](https://github.com/stdlib-js/stdlib/commit/b5a916e413d8658977ab2383ec6fe411f90c557d) - **feat:** update `ndarray/base` TypeScript declarations [(#8127)](https://github.com/stdlib-js/stdlib/pull/8127) _(by stdlib-bot)_
595597
- [`5c3691e`](https://github.com/stdlib-js/stdlib/commit/5c3691efad0d8f75effc471424caa0473cb264ac) - **test:** add tests to `ndarray/every` for complete test coverage [(#8124)](https://github.com/stdlib-js/stdlib/pull/8124) _(by Muhammad Haris, Athan Reines)_
596598
- [`5b42c46`](https://github.com/stdlib-js/stdlib/commit/5b42c466e82c41e5ef0d52bac26a1d4fa03ac31a) - **test:** fix description _(by Athan Reines)_

some-by/docs/repl.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
predicate: Function
2929
Predicate function.
3030

31-
thisArg: Any (optional)
31+
thisArg: any (optional)
3232
Predicate execution context.
3333

3434
Returns
@@ -55,7 +55,8 @@
5555

5656
{{alias}}.assign( x, n, y[, options], predicate[, thisArg] )
5757
Tests whether at least `n` elements along one or more ndarray dimensions
58-
pass a test implemented by a predicate function.
58+
pass a test implemented by a predicate function and assigns the results to
59+
a provided output ndarray.
5960

6061
Parameters
6162
----------
@@ -79,14 +80,10 @@
7980
the function performs a reduction over all elements in a provided input
8081
ndarray.
8182

82-
options.keepdims: boolean (optional)
83-
Boolean indicating whether the reduced dimensions should be included in
84-
the returned ndarray as singleton dimensions. Default: false.
85-
8683
predicate: Function
8784
Predicate function.
8885

89-
thisArg: Any (optional)
86+
thisArg: any (optional)
9087
Predicate execution context.
9188

9289
Returns

some-by/docs/types/index.d.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
import { ArrayLike } from '@stdlib/types/array';
2424
import { ndarray, boolndarray, integerndarray, typedndarray } from '@stdlib/types/ndarray';
2525

26+
/**
27+
* Input array.
28+
*/
29+
type InputArray<T> = typedndarray<T>;
30+
2631
/**
2732
* Returns a boolean indicating whether an element passes a test.
2833
*
@@ -55,7 +60,7 @@ type Binary<T, ThisArg> = ( this: ThisArg, value: T, indices: Array<number> ) =>
5560
* @param arr - input array
5661
* @returns boolean indicating whether an ndarray element passes a test
5762
*/
58-
type Ternary<T, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>, arr: typedndarray<T> ) => boolean;
63+
type Ternary<T, U, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>, arr: U ) => boolean;
5964

6065
/**
6166
* Returns a boolean indicating whether an element passes a test.
@@ -65,7 +70,7 @@ type Ternary<T, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>, ar
6570
* @param arr - input array
6671
* @returns boolean indicating whether an ndarray element passes a test
6772
*/
68-
type Predicate<T, ThisArg> = Nullary<ThisArg> | Unary<T, ThisArg> | Binary<T, ThisArg> | Ternary<T, ThisArg>;
73+
type Predicate<T, U, ThisArg> = Nullary<ThisArg> | Unary<T, ThisArg> | Binary<T, ThisArg> | Ternary<T, U, ThisArg>;
6974

7075
/**
7176
* Base options.
@@ -127,7 +132,7 @@ interface SomeBy {
127132
* var v = out.get();
128133
* // returns true
129134
*/
130-
<T = unknown, U = unknown>( x: ndarray, n: integerndarray | number, predicate: Predicate<T, U>, thisArg?: ThisParameterType<Predicate<T, U>> ): boolndarray;
135+
<T = unknown, U extends InputArray<T> = InputArray<T>, ThisArg = unknown>( x: U, n: integerndarray | number, predicate: Predicate<T, U, ThisArg>, thisArg?: ThisParameterType<Predicate<T, U, ThisArg>> ): boolndarray;
131136

132137
/**
133138
* Tests whether at least `n` elements along one or more ndarray dimensions pass a test implemented by a predicate function.
@@ -168,7 +173,7 @@ interface SomeBy {
168173
* var v = out.get();
169174
* // returns true
170175
*/
171-
<T = unknown, U = unknown>( x: ndarray, n: integerndarray | number, options: Options, predicate: Predicate<T, U>, thisArg?: ThisParameterType<Predicate<T, U>> ): boolndarray;
176+
<T = unknown, U extends InputArray<T> = InputArray<T>, ThisArg = unknown>( x: U, n: integerndarray | number, options: Options, predicate: Predicate<T, U, ThisArg>, thisArg?: ThisParameterType<Predicate<T, U, ThisArg>> ): boolndarray;
172177

173178
/**
174179
* Tests whether at least `n` elements along one or more ndarray dimensions pass a test implemented by a predicate function.
@@ -213,7 +218,7 @@ interface SomeBy {
213218
* var v = out.get();
214219
* // returns true
215220
*/
216-
assign<T = unknown, U extends ndarray = ndarray, V = unknown>( x: ndarray, n: integerndarray | number, y: U, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): U;
221+
assign<T = unknown, U extends InputArray<T> = InputArray<T>, V extends ndarray = ndarray, ThisArg = unknown>( x: ndarray, n: integerndarray | number, y: V, predicate: Predicate<T, U, ThisArg>, thisArg?: ThisParameterType<Predicate<T, U, ThisArg>> ): V;
217222

218223
/**
219224
* Tests whether at least `n` elements along one or more ndarray dimensions pass a test implemented by a predicate function.
@@ -260,7 +265,7 @@ interface SomeBy {
260265
* var v = out.get();
261266
* // returns true
262267
*/
263-
assign<T = unknown, U extends ndarray = ndarray, V = unknown>( x: ndarray, n: integerndarray | number, y: U, options: BaseOptions, predicate: Predicate<T, V>, thisArg?: ThisParameterType<Predicate<T, V>> ): U;
268+
assign<T = unknown, U extends InputArray<T> = InputArray<T>, V extends ndarray = ndarray, ThisArg = unknown>( x: ndarray, n: integerndarray | number, y: V, options: BaseOptions, predicate: Predicate<T, U, ThisArg>, thisArg?: ThisParameterType<Predicate<T, U, ThisArg>> ): V;
264269
}
265270

266271
/**

some-by/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
7070
* @throws {TypeError} options argument must be an object
7171
* @throws {TypeError} callback argument must be a function
7272
* @throws {RangeError} dimension indices must not exceed input ndarray bounds
73-
* @throws {RangeError} number of dimension indices must not exceed the number of input ndarray dimensions
73+
* @throws {Error} dimension indices must be unique
7474
* @throws {Error} must provide valid options
7575
* @returns {ndarray} output ndarray
7676
*

some-by/lib/validate.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ function validate( opts, ndims, options ) {
7676
if ( tmp.length !== opts.dims.length ) {
7777
return new Error( format( 'invalid option. `%s` option contains duplicate indices. Option: [%s].', 'dims', join( opts.dims, ',' ) ) );
7878
}
79-
if ( tmp.length > ndims ) {
80-
return new RangeError( format( 'invalid option. `%s` option specifies more dimensions than exists in the input array. Number of dimensions: %d. Option: [%s].', 'dims', ndims, join( opts.dims, ',' ) ) );
81-
}
8279
opts.dims = tmp;
8380
}
8481
return null;

0 commit comments

Comments
 (0)