Skip to content

Commit 947577c

Browse files
committed
docs: update return annotations to use ndarray instance notation in stats/range-by
1 parent e57055b commit 947577c

5 files changed

Lines changed: 22 additions & 54 deletions

File tree

lib/node_modules/@stdlib/stats/range-by/README.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ function clbk( v ) {
5252
}
5353

5454
var y = rangeBy( x, clbk );
55-
// returns <ndarray>
56-
57-
var v = y.get();
58-
// returns 10.0
55+
// returns <ndarray>[ 10.0 ]
5956
```
6057

6158
The function has the following parameters:
@@ -89,10 +86,7 @@ var ctx = {
8986
'count': 0
9087
};
9188
var y = rangeBy( x, clbk, ctx );
92-
// returns <ndarray>
93-
94-
var v = y.get();
95-
// returns 10.0
89+
// returns <ndarray>[ 10.0 ]
9690

9791
var count = ctx.count;
9892
// returns 3
@@ -119,7 +113,7 @@ var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
119113
'order': 'row-major'
120114
});
121115
var v = ndarray2array( x );
122-
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
116+
// returns <ndarray>[ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
123117

124118
var opts = {
125119
'dims': [ 0 ]
@@ -128,7 +122,7 @@ var y = rangeBy( x, opts, clbk );
128122
// returns <ndarray>
129123

130124
v = ndarray2array( y );
131-
// returns [ 200.0, 200.0 ]
125+
// returns <ndarray>[ [ 200.0, 200.0 ] ]
132126

133127
opts = {
134128
'dims': [ 1 ]
@@ -137,16 +131,13 @@ y = rangeBy( x, opts, clbk );
137131
// returns <ndarray>
138132

139133
v = ndarray2array( y );
140-
// returns [ 300.0, 700.0 ]
134+
// returns <ndarray>[ [ 300.0, 700.0 ] ]
141135

142136
opts = {
143137
'dims': [ 0, 1 ]
144138
};
145139
y = rangeBy( x, opts, clbk );
146-
// returns <ndarray>
147-
148-
v = y.get();
149-
// returns 700.0
140+
// returns <ndarray>[ 700.0 ]
150141
```
151142

152143
By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
@@ -165,7 +156,7 @@ var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
165156
});
166157

167158
var v = ndarray2array( x );
168-
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
159+
// returns <ndarray>[ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
169160

170161
var opts = {
171162
'dims': [ 0 ],
@@ -175,7 +166,7 @@ var y = rangeBy( x, opts, clbk );
175166
// returns <ndarray>
176167

177168
v = ndarray2array( y );
178-
// returns [ [ 200.0, 200.0 ] ]
169+
// returns <ndarray>[ [ [ 200.0, 200.0 ] ] ]
179170

180171
opts = {
181172
'dims': [ 1 ],
@@ -185,7 +176,7 @@ y = rangeBy( x, opts, clbk );
185176
// returns <ndarray>
186177

187178
v = ndarray2array( y );
188-
// returns [ [ 300.0 ], [ 700.0 ] ]
179+
// returns <ndarray>[ [ [ 300.0 ], [ 700.0 ] ] ]
189180

190181
opts = {
191182
'dims': [ 0, 1 ],
@@ -195,7 +186,7 @@ y = rangeBy( x, opts, clbk );
195186
// returns <ndarray>
196187

197188
v = ndarray2array( y );
198-
// returns [ [ 700.0 ] ]
189+
// returns <ndarray>[ [ [ [ 700.0 ] ] ] ]
199190
```
200191

201192
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
@@ -238,10 +229,7 @@ var x = array( [ -1.0, 2.0, -3.0 ] );
238229
var y = zeros( [] );
239230

240231
var out = rangeBy.assign( x, y, clbk );
241-
// returns <ndarray>
242-
243-
var v = out.get();
244-
// returns 500.0
232+
// returns <ndarray>[ 500.0 ]
245233

246234
var bool = ( out === y );
247235
// returns true
@@ -316,7 +304,7 @@ var opts = {
316304
var y = rangeBy( x, opts, accessor );
317305

318306
// Resolve the output array data type:
319-
var dt = getDType( y );
307+
var dt = String( getDType( y ) );
320308
console.log( dt );
321309

322310
// Print the results:

lib/node_modules/@stdlib/stats/range-by/docs/repl.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, 4.0 ] );
5151
> function clbk( v ) { return v * 2.0; };
5252
> var y = {{alias}}( x, clbk );
53-
> var v = y.get()
54-
14.0
53+
> y
54+
<ndarray>[ 14.0 ]
5555

5656

5757
{{alias}}.assign( x, out[, options], clbk[, thisArg] )
@@ -102,11 +102,9 @@
102102
> var out = {{alias:@stdlib/ndarray/zeros}}( [] );
103103
> function clbk( v ) { return v * 2.0; };
104104
> var y = {{alias}}.assign( x, out, clbk )
105-
<ndarray>
105+
<ndarray>[ 14.0 ]
106106
> var bool = ( out === y )
107107
true
108-
> var v = out.get()
109-
14.0
110108

111109
See Also
112110
--------

lib/node_modules/@stdlib/stats/range-by/docs/types/index.d.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ interface Unary {
124124
* var x = array( [ -1.0, 2.0, -3.0 ] );
125125
*
126126
* var y = rangeBy( x, clbk );
127-
* // returns <ndarray>
128-
*
129-
* var v = y.get();
130-
* // returns 10.0
127+
* // returns <ndarray>[ 10.0 ]
131128
*/
132129
<T = unknown, U extends InputArray<T> = InputArray<T>, ThisArg = unknown>( x: U, clbk: Callback<T, U, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, ThisArg>> ): OutputArray<number>; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
133130

@@ -150,10 +147,7 @@ interface Unary {
150147
* var x = array( [ -1.0, 2.0, -3.0 ] );
151148
*
152149
* var y = rangeBy( x, {}, clbk );
153-
* // returns <ndarray>
154-
*
155-
* var v = y.get();
156-
* // returns 10.0
150+
* // returns <ndarray>[ 10.0 ]
157151
*/
158152
<T = unknown, U extends InputArray<T> = InputArray<T>, ThisArg = unknown>( x: U, options: Options, clbk: Callback<T, U, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, ThisArg>> ): OutputArray<number>; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
159153

@@ -178,10 +172,7 @@ interface Unary {
178172
* }
179173
*
180174
* var out = rangeBy.assign( x, y, clbk );
181-
* // returns <ndarray>
182-
*
183-
* var v = out.get();
184-
* // returns 10.0
175+
* // returns <ndarray>[ 10.0 ]
185176
*
186177
* var bool = ( out === y );
187178
* // returns true
@@ -210,10 +201,7 @@ interface Unary {
210201
* }
211202
*
212203
* var out = rangeBy.assign( x, y, {}, clbk );
213-
* // returns <ndarray>
214-
*
215-
* var v = out.get();
216-
* // returns 10.0
204+
* // returns <ndarray>[ 10.0 ]
217205
*
218206
* var bool = ( out === y );
219207
* // returns true

lib/node_modules/@stdlib/stats/range-by/lib/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,8 @@
5050
*
5151
* // Perform reduction:
5252
* var out = rangeBy( x, clbk );
53-
* // returns <ndarray>
54-
*
55-
* var v = out.get();
56-
* // returns 18.0
57-
*/
53+
* // returns <ndarray>[ 18.0 ]
54+
5855

5956
// MODULES //
6057

lib/node_modules/@stdlib/stats/range-by/lib/main.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ var table = {
8686
*
8787
* // Perform reduction:
8888
* var out = rangeBy( x, clbk );
89-
* // returns <ndarray>
90-
*
91-
* var v = out.get();
92-
* // returns 18.0
89+
* // returns <ndarray>[ 18.0 ]
9390
*/
9491
var rangeBy = factory( table, [ idtypes ], odtypes, policies );
9592

0 commit comments

Comments
 (0)