Skip to content

Commit c62bd4d

Browse files
committed
docs: apply code review suggestions
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 79eb09a commit c62bd4d

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

lib/node_modules/@stdlib/ndarray/base/find/README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# find
2222

23-
> Return the first element in an ndarray which pass a test implemented by a predicate function.
23+
> Return the first element in an ndarray which passes a test implemented by a predicate function.
2424
2525
<section class="intro">
2626

@@ -42,14 +42,14 @@ var find = require( '@stdlib/ndarray/base/find' );
4242

4343
#### find( arrays, predicate\[, thisArg] )
4444

45-
Returns the first element in an ndarray which pass a test implemented by a predicate function.
45+
Returns the first element in an ndarray which passes a test implemented by a predicate function.
4646

4747
<!-- eslint-disable max-len -->
4848

4949
```javascript
5050
var Float64Array = require( '@stdlib/array/float64' );
5151

52-
function clbk( value ) {
52+
function isEven( value ) {
5353
return value % 2.0 === 0.0;
5454
}
5555

@@ -65,16 +65,6 @@ var sx = [ 4, 4, 1 ];
6565
// Define the index offset:
6666
var ox = 0;
6767

68-
// Create the sentinel value ndarray-like object:
69-
var sentinelValue = {
70-
'dtype': 'float64',
71-
'data': new Float64Array( [ NaN ] ),
72-
'shape': [],
73-
'strides': [ 0 ],
74-
'offset': 0,
75-
'order': 'row-major'
76-
};
77-
7868
// Create the input ndarray-like object:
7969
var x = {
8070
'dtype': 'float64',
@@ -85,14 +75,24 @@ var x = {
8575
'order': 'row-major'
8676
};
8777

78+
// Create the sentinel value ndarray-like object:
79+
var sentinelValue = {
80+
'dtype': 'float64',
81+
'data': new Float64Array( [ NaN ] ),
82+
'shape': [],
83+
'strides': [ 0 ],
84+
'offset': 0,
85+
'order': 'row-major'
86+
};
87+
8888
// Perform reduction:
89-
var out = find( [ x, sentinelValue ], clbk );
89+
var out = find( [ x, sentinelValue ], isEven );
9090
// returns 2.0
9191
```
9292

9393
The function accepts the following arguments:
9494

95-
- **arrays**: array-like object containing an input ndarray and a zero-dimensional sentinel value ndarray.
95+
- **arrays**: array-like object containing an input ndarray and a zero-dimensional ndarray containing a sentinel value which should be returned when no element in an input ndarray passes a test implemented by the predicate function.
9696
- **predicate**: predicate function.
9797
- **thisArg**: predicate function execution context (_optional_).
9898

@@ -118,7 +118,7 @@ To set the predicate function execution context, provide a `thisArg`.
118118
```javascript
119119
var Float64Array = require( '@stdlib/array/float64' );
120120

121-
function clbk( value ) {
121+
function isEven( value ) {
122122
this.count += 1;
123123
return value % 2.0 === 0.0;
124124
}
@@ -135,16 +135,6 @@ var sx = [ 4, 4, 1 ];
135135
// Define the index offset:
136136
var ox = 0;
137137

138-
// Create the sentinel value ndarray-like object:
139-
var sentinelValue = {
140-
'dtype': 'float64',
141-
'data': new Float64Array( [ NaN ] ),
142-
'shape': [],
143-
'strides': [ 0 ],
144-
'offset': 0,
145-
'order': 'row-major'
146-
};
147-
148138
// Create the input ndarray-like object:
149139
var x = {
150140
'dtype': 'float64',
@@ -155,12 +145,22 @@ var x = {
155145
'order': 'row-major'
156146
};
157147

148+
// Create the sentinel value ndarray-like object:
149+
var sentinelValue = {
150+
'dtype': 'float64',
151+
'data': new Float64Array( [ NaN ] ),
152+
'shape': [],
153+
'strides': [ 0 ],
154+
'offset': 0,
155+
'order': 'row-major'
156+
};
157+
158158
var ctx = {
159159
'count': 0
160160
};
161161

162162
// Test elements:
163-
var out = find( [ x, sentinelValue ], clbk, ctx );
163+
var out = find( [ x, sentinelValue ], isEven, ctx );
164164
// returns 2.0
165165

166166
var count = ctx.count;
@@ -193,7 +193,7 @@ var Float64Array = require( '@stdlib/array/float64' );
193193
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
194194
var find = require( '@stdlib/ndarray/base/find' );
195195

196-
function clbk( value ) {
196+
function isEven( value ) {
197197
return value % 2.0 === 0.0;
198198
}
199199

@@ -219,7 +219,7 @@ var sv = {
219219
};
220220
console.log( 'Sentinel Value: %d', sv.data[ 0 ] );
221221

222-
var out = find( [ x, sv ], clbk );
222+
var out = find( [ x, sv ], isEven );
223223
console.log( out );
224224
```
225225

lib/node_modules/@stdlib/ndarray/base/find/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/ndarray/base/find",
33
"version": "0.0.0",
4-
"description": "Return the first element in an ndarray which pass a test implemented by a predicate function.",
4+
"description": "Return the first element in an ndarray which passes a test implemented by a predicate function.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

0 commit comments

Comments
 (0)