Skip to content

Commit 3a32075

Browse files
committed
Auto-generated commit
1 parent 784ead4 commit 3a32075

File tree

7 files changed

+30
-79
lines changed

7 files changed

+30
-79
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ A total of 40 issues were closed in this release:
709709

710710
<details>
711711

712+
- [`51f5eea`](https://github.com/stdlib-js/stdlib/commit/51f5eea4350c3aff97620bda4ff3066935c23e3f) - **docs:** improve doctests for ndarray instances in `ndarray/some-by` [(#9410)](https://github.com/stdlib-js/stdlib/pull/9410) _(by kaushal-kumar-it, Athan Reines)_
712713
- [`571b88f`](https://github.com/stdlib-js/stdlib/commit/571b88f7e7b93c3578efc017cb8e3bd9b6b99954) - **docs:** improve doctests for ndarray instances in `ndarray/map` [(#9676)](https://github.com/stdlib-js/stdlib/pull/9676) _(by Shreelaxmi Hegde, Athan Reines)_
713714
- [`709563c`](https://github.com/stdlib-js/stdlib/commit/709563c0d7337b5c0632d1988fb263cf39305f86) - **feat:** update `ndarray/base` TypeScript declarations [(#9716)](https://github.com/stdlib-js/stdlib/pull/9716) _(by stdlib-bot)_
714715
- [`6aee8e2`](https://github.com/stdlib-js/stdlib/commit/6aee8e232a2cebd57d5246d76ffe08e67941c0a4) - **docs:** move content to notes _(by Athan Reines)_

some-by/README.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] );
5353

5454
// Perform reduction:
5555
var out = someBy( x, 2, predicate );
56-
// returns <ndarray>
57-
58-
var v = out.get();
59-
// returns true
56+
// returns <ndarray>[ true ]
6057
```
6158

6259
The function accepts the following arguments:
@@ -76,7 +73,6 @@ By default, the function performs a reduction over all elements in a provided [`
7673

7774
```javascript
7875
var array = require( '@stdlib/ndarray/array' );
79-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
8076

8177
function predicate( value ) {
8278
return value > 0.0;
@@ -92,17 +88,13 @@ var opts = {
9288

9389
// Perform reduction:
9490
var out = someBy( x, 2, opts, predicate );
95-
// returns <ndarray>
96-
97-
var v = ndarray2array( out );
98-
// returns [ true, true ]
91+
// returns <ndarray>[ true, true ]
9992
```
10093

10194
By default, the function returns an [`ndarray`][@stdlib/ndarray/ctor] having a shape matching only the non-reduced dimensions of the input [`ndarray`][@stdlib/ndarray/ctor] (i.e., the reduced dimensions are dropped). To include the reduced dimensions as singleton dimensions in the output [`ndarray`][@stdlib/ndarray/ctor], set the `keepdims` option to `true`.
10295

10396
```javascript
10497
var array = require( '@stdlib/ndarray/array' );
105-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
10698

10799
function predicate( value ) {
108100
return value > 0.0;
@@ -119,10 +111,7 @@ var opts = {
119111

120112
// Perform reduction:
121113
var out = someBy( x, 2, opts, predicate );
122-
// returns <ndarray>
123-
124-
var v = ndarray2array( out );
125-
// returns [ [ [ true, true ] ] ]
114+
// returns <ndarray>[ [ [ true, true ] ] ]
126115
```
127116

128117
To set the predicate function execution context, provide a `thisArg`.
@@ -148,10 +137,7 @@ var ctx = {
148137

149138
// Perform reduction:
150139
var out = someBy( x, 2, predicate, ctx );
151-
// returns <ndarray>
152-
153-
var v = out.get();
154-
// returns true
140+
// returns <ndarray>[ true ]
155141

156142
var count = ctx.count;
157143
// returns 2
@@ -180,13 +166,10 @@ var y = empty( [], {
180166

181167
// Perform reduction:
182168
var out = someBy.assign( x, 2, y, predicate );
183-
// returns <ndarray>
169+
// returns <ndarray>[ true ]
184170

185171
var bool = ( out === y );
186172
// returns true
187-
188-
var v = y.get();
189-
// returns true
190173
```
191174

192175
The function accepts the following arguments:
@@ -207,7 +190,6 @@ By default, the function performs a reduction over all elements in a provided [`
207190
```javascript
208191
var array = require( '@stdlib/ndarray/array' );
209192
var empty = require( '@stdlib/ndarray/empty' );
210-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
211193

212194
function predicate( value ) {
213195
return value > 0.0;
@@ -228,12 +210,10 @@ var opts = {
228210

229211
// Perform reduction:
230212
var out = someBy.assign( x, 2, y, opts, predicate );
213+
// returns <ndarray>[ true, true ]
231214

232215
var bool = ( out === y );
233216
// returns true
234-
235-
var v = ndarray2array( y );
236-
// returns [ true, true ]
237217
```
238218

239219
</section>

some-by/docs/repl.txt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,9 @@
4242
> function f ( v ) { return v > 0.0; };
4343
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2], [ 3, 4 ] ] );
4444
> var y = {{alias}}( x, 3, f )
45-
<ndarray>
46-
> y.get()
47-
true
45+
<ndarray>[ true ]
4846
> y = {{alias}}( x, 3, { 'keepdims': true }, f )
49-
<ndarray>
50-
> {{alias:@stdlib/ndarray/to-array}}( y )
51-
[ [ true ] ]
52-
> y.get( 0, 0 )
53-
true
47+
<ndarray>[ [ true ] ]
5448

5549

5650
{{alias}}.assign( x, n, y[, options], predicate[, thisArg] )
@@ -97,11 +91,9 @@
9791
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2], [ 3, 4 ] ] );
9892
> var y = {{alias:@stdlib/ndarray/from-scalar}}( false );
9993
> var out = {{alias}}.assign( x, 3, y, f )
100-
<ndarray>
94+
<ndarray>[ true ]
10195
> var bool = ( out === y )
10296
true
103-
> y.get()
104-
true
10597

10698
See Also
10799
--------

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

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ interface SomeBy {
127127
*
128128
* // Perform reduction:
129129
* var out = someBy( x, 3, isEven );
130-
* // returns <ndarray>
131-
*
132-
* var v = out.get();
133-
* // returns true
130+
* // returns <ndarray>[ true ]
134131
*/
135132
<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;
136133

@@ -168,10 +165,7 @@ interface SomeBy {
168165
*
169166
* // Perform reduction:
170167
* var out = someBy( x, 3, {}, isEven );
171-
* // returns <ndarray>
172-
*
173-
* var v = out.get();
174-
* // returns true
168+
* // returns <ndarray>[ true ]
175169
*/
176170
<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;
177171

@@ -213,10 +207,7 @@ interface SomeBy {
213207
*
214208
* // Perform reduction:
215209
* var out = someBy.assign( x, 3, y, isEven );
216-
* // returns <ndarray>
217-
*
218-
* var v = out.get();
219-
* // returns true
210+
* // returns <ndarray>[ true ]
220211
*/
221212
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;
222213

@@ -260,10 +251,7 @@ interface SomeBy {
260251
*
261252
* // Perform reduction:
262253
* var out = someBy.assign( x, 3, y, {}, isEven );
263-
* // returns <ndarray>
264-
*
265-
* var v = out.get();
266-
* // returns true
254+
* // returns <ndarray>[ true ]
267255
*/
268256
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;
269257
}
@@ -302,10 +290,7 @@ interface SomeBy {
302290
*
303291
* // Perform reduction:
304292
* var out = someBy( x, 3, isEven );
305-
* // returns <ndarray>
306-
*
307-
* var v = out.get();
308-
* // returns true
293+
* // returns <ndarray>[ true ]
309294
*
310295
* @example
311296
* var Float64Array = require( '@stdlib/array/float64' );
@@ -335,10 +320,7 @@ interface SomeBy {
335320
*
336321
* // Perform reduction:
337322
* var out = someBy.assign( x, 3, y, isEven );
338-
* // returns <ndarray>
339-
*
340-
* var v = out.get();
341-
* // returns true
323+
* // returns <ndarray>[ true ]
342324
*/
343325
declare var someBy: SomeBy;
344326

some-by/lib/assign.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
9393
*
9494
* // Perform reduction:
9595
* var out = assign( x, 3, y, isEven );
96-
* // returns <ndarray>
97-
*
98-
* var v = out.get();
99-
* // returns true
96+
* // returns <ndarray>[ true ]
10097
*/
10198
function assign( x, n, y, options, predicate, thisArg ) {
10299
var nargs;

some-by/lib/index.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@
4343
* // Create an input ndarray:
4444
* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
4545
*
46-
* // Perform reduction:
47-
* var out = someBy( x, 6 );
48-
* // returns <ndarray>
46+
* function predicate( v ) {
47+
* return v > 0.0;
48+
* }
4949
*
50-
* var v = out.get();
51-
* // returns true
50+
* // Perform reduction:
51+
* var out = someBy( x, 6, predicate );
52+
* // returns <ndarray>[ true ]
5253
*
5354
* @example
5455
* var Float64Array = require( '@stdlib/array/float64' );
@@ -76,12 +77,13 @@
7677
* 'dtype': 'bool'
7778
* });
7879
*
79-
* // Perform reduction:
80-
* var out = someBy.assign( x, 6.0, y );
81-
* // returns <ndarray>
80+
* function predicate( v ) {
81+
* return v > 0.0;
82+
* }
8283
*
83-
* var v = out.get();
84-
* // returns true
84+
* // Perform reduction:
85+
* var out = someBy.assign( x, 6.0, y, predicate );
86+
* // returns <ndarray>[ true ]
8587
*/
8688

8789
// MODULES //

some-by/lib/main.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
9696
*
9797
* // Perform reduction:
9898
* var out = someBy( x, 3, isEven );
99-
* // returns <ndarray>
100-
*
101-
* var v = out.get();
102-
* // returns true
99+
* // returns <ndarray>[ true ]
103100
*/
104101
function someBy( x, n, options, predicate, thisArg ) {
105102
var nargs;

0 commit comments

Comments
 (0)