Skip to content

Commit 5ded71b

Browse files
committed
feat: refactor and add protocol support to stats/base/max-by
--- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - 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 50017c4 commit 5ded71b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/node_modules/@stdlib/stats/base/max-by/lib/accessors.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
3030
* Calculates the maximum value of a strided array via a callback function.
3131
*
3232
* @param {PositiveInteger} N - number of indexed elements
33-
* @param {Collection} x - input array/collection
34-
* @param {integer} stride - index increment
33+
* @param {Object} x - input array object
34+
* @param {Array<Function>} x.accessors - array element accessors
35+
* @param {integer} stride - stride length
3536
* @param {Callback} clbk - callback
3637
* @param {*} [thisArg] - execution context
3738
* @returns {number} maximum value
@@ -49,9 +50,8 @@ var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
4950
*
5051
*/
5152
function maxBy( N, x, stride, clbk, thisArg ) {
52-
var itemx;
5353
var xbuf;
54-
var item;
54+
var tmp;
5555
var get;
5656
var max;
5757
var ix;
@@ -81,8 +81,8 @@ function maxBy( N, x, stride, clbk, thisArg ) {
8181
ix = 0;
8282
}
8383
for ( i = 0; i < N; i++) {
84-
item = get( xbuf, ix );
85-
max = clbk.call( thisArg, item, i, ix, x);
84+
tmp = get( xbuf, ix );
85+
max = clbk.call( thisArg, tmp, i, ix, x);
8686
if ( max !== void 0 ) {
8787
break;
8888
}
@@ -94,8 +94,8 @@ function maxBy( N, x, stride, clbk, thisArg ) {
9494
i += 1;
9595
for ( i; i < N; i++) {
9696
ix += stride;
97-
itemx = get( xbuf, ix );
98-
v = clbk.call( thisArg, itemx, i, ix, x );
97+
tmp = get( xbuf, ix );
98+
v = clbk.call( thisArg, tmp, i, ix, x );
9999
if ( v === void 0 ) {
100100
continue;
101101
}

0 commit comments

Comments
 (0)