Repository: stdlib-js/stdlib (2025-03-09T07:18:13Z)

Issue:
[RFC]: refactor and add protocol support to `stats/base/range-by`
## Description

This RFC proposes refactoring and adding accessor protocol support to [`@stdlib/stats/base/range-by`](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/range-by).

For background on the accessor protocol, see https://blog.stdlib.io/introducing-the-accessor-protocol-for-array-like-objects/.

Examples of what we are looking for:

- `stats/base/min`: https://github.com/stdlib-js/stdlib/commit/fbb31fbaafbbbf233740a41a88a57f4db1cb427b ([package](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/min))
- `stats/base/cumax`: https://github.com/stdlib-js/stdlib/commit/11f1341134c5d6c7c0ecd82c99dff766e08e731a ([package](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/cumax))
- `stats/base/cumin`: https://github.com/stdlib-js/stdlib/commit/528efd8000eb7b910f64e63796a8a7c2fdfa03cd ([package](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/cumin))
- `stats/base/mediansorted`: https://github.com/stdlib-js/stdlib/commit/065f86535e3f1915160f91820f1fa0af79633b72 ([package](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/mediansorted))
- `stats/base/mskmax`: https://github.com/stdlib-js/stdlib/commit/417e65361234ec46382f58cc303a544f5bbcbf9e ([package](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/mskmax))

While the changes proposed in this RFC will **not** match the implementations found in the above packages, the packages should provide a conceptual idea of what is desired. Do **not** simply copy-paste the code found in those packages without reasoning about expected behavior and API design.

### Key Points

#### Refactoring

When refactoring and cleaning up existing implementations, pay special attention to the changes made in the commits referred to above. You'll need to go line-by-line in [`@stdlib/stats/base/range-by`](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/range-by) and compare with the changes made in the above commits.

In particular, we're interested in

1. standardizing language in descriptions so that all packages in `stats/base` use similar language for describing input parameters and behavior.
2. updating examples to align with current conventions in stdlib.
3. simplifying examples and benchmarks to use utilities for generating random arrays.
4. reducing code duplication by having the main package entry point delegate to the `ndarray` API.

#### Accessor protocol

Prior to adding accessor protocol support, check whether the implementation has any strided array dependencies. For example, for certain algorithms for computing the mean, implementations will depend on algorithms for computing the sum. Ensure that the upstream implementations have support for accessor arrays. If not, you'll need to open a separate PR adding support in the upstream dependencies before working on this package.

When adding support for the accessor protocol, you'll need to do the following:

##### Create an accessors file

Create a new `lib/accessors.js` file. This file will contain an implementation which can handle accessor arrays.

##### Modify the ndarray file

Modify the `lib/ndarray.js` file to delegate to the accessors implementation when one (or more) of the input arrays is an accessor array.

##### Update tests

Modify the tests to include explicit tests for accessor arrays.

#### Run tests and other commands

For each of the following commands, please run them from the root stdlib repository directory (not the package folder!).

To run unit tests,

```bash
make test TESTS_FILTER=".*/stats/base/range-by/.*"
```

To run examples,

```bash
make examples EXAMPLES_FILTER=".*/stats/base/range-by/.*"
```

To run benchmarks,

```bash
make benchmark BENCHMARKS_FILTER=".*/stats/base/range-by/.*"
```

### Create pull request

Provided all tests, examples, and benchmarks successfully execute and pass and that you've updated the package's documentation, you are now ready to open a pull request!

* * *

## Notes

- If you are interested in contributing a PR which addresses this RFC and still getting familiar with our project conventions, please do **not** submit LLM-generated code. Please consult our [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) and the associated [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md). Failure to respect project conventions will result in your PR being rejected without review. Thank you for understanding!

### Checklist

- [X] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [X] Searched for existing issues and pull requests.
- [X] The issue name begins with `[RFC]:`.



Discussion:
# :wave: Important: PLEASE READ :wave:

This issue has been labeled as a **good first issue** and is available for anyone to work on.

If this is your first time contributing to an open source project, some aspects of the development process may seem unusual, arcane, or some combination of both.

1.  **You cannot "claim" issues.** People new to open source often want to "claim" or be assigned an issue before beginning work. The typical rationale is that people want to avoid wasted work in the event that someone else ends up working the issue. However, this practice is not effective in open source, as it often leads to "issue squatting", in which an individual asks to be assigned, is granted their request, and then never ends up working on the issue. Accordingly, you are encouraged to communicate your intent to address this issue, ideally by providing a rough outline as to how you plan to address the issue or asking clarifying questions, but, at the end of the day, we will take running code and rough consensus in order to move forward quickly.
2.  **We have a very high bar for contributions.** We have very high standards for contributions and expect all contributions—whether new features, tests, or documentation—to be rigorous, thorough, and complete. Once a pull request is merged into stdlib, that contribution immediately becomes the collective responsibility of all maintainers of stdlib. When we merge code into stdlib, we are saying that we, the maintainers, commit to reviewing subsequent changes and making bugfixes to the code. Hence, in order to ensure future maintainability, this naturally leads to a higher standard of contribution.

Before working on this issue and opening a pull request, please read the project's [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md). These guidelines and the associated [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) provide important information, including links to stdlib's [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md), license policy, and steps for setting up your local development environment.

To reiterate, we **strongly** encourage you to refer to our contributing guides **before** beginning work on this issue. Failure to follow our guidelines significantly decreases the likelihood that you'll successfully contribute to stdlib and may result in automatic closure of a pull request without review.

Setting up your local development environment is a critical first step, as doing so ensures that automated development processes for linting, license verification, and unit testing can run prior to authoring commits and pushing changes. If you would prefer to avoid manual setup, we provide pre-configured [development containers](https://github.com/stdlib-js/stdlib/tree/develop/.devcontainer) for use locally or in GitHub Codespaces.

We place a high value on consistency throughout the stdlib codebase. We encourage you to closely examine other packages in stdlib and attempt to emulate the practices and conventions found therein.

-   If you are attempting to contribute a new package, sometimes the best approach is to simply copy the contents of an existing package and then modify the minimum amount necessary to implement the feature (e.g., changing descriptions, parameter names, and implementation).
-   If you are contributing tests, find a package implementing a similar feature and emulate the tests of that package.
-   If you are updating documentation, examine several similar packages and emulate the content, style, and prose of those packages.

In short, the more effort you put in to ensure that your contribution looks and feels like stdlib—including variables names, bracket spacing, line breaks, etc—the more likely that your contribution will be reviewed and ultimately accepted. We encourage you to closely study the codebase **before** beginning work on this issue.

:sparkles: Thank you again for your interest in stdlib, and we look forward to reviewing your future contributions. :sparkles:




Patch:
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/README.md b/lib/node_modules/@stdlib/stats/base/range-by/README.md
index 1cb62cb91f51..cf5007ffb5f7 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/README.md
+++ b/lib/node_modules/@stdlib/stats/base/range-by/README.md
@@ -38,9 +38,9 @@ The [**range**][range] is defined as the difference between the maximum and mini
 var rangeBy = require( '@stdlib/stats/base/range-by' );
 ```
 
-#### rangeBy( N, x, stride, clbk\[, thisArg] )
+#### rangeBy( N, x, strideX, clbk\[, thisArg] )
 
-Calculates the [range][range] of strided array `x` via a callback function.
+Computes the [range][range] of a strided array via a callback function.
 
 ```javascript
 function accessor( v ) {
@@ -57,7 +57,7 @@ The function has the following parameters:
 
 -   **N**: number of indexed elements.
 -   **x**: input [`Array`][mdn-array], [`typed array`][mdn-typed-array], or an array-like object (excluding strings and functions).
--   **stride**: index increment.
+-   **strideX**: stride length.
 -   **clbk**: callback function.
 -   **thisArg**: execution context (_optional_).
 
@@ -89,19 +89,16 @@ var cnt = context.count;
 // returns 8
 ```
 
-The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to access every other element
+The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to access every other element
 
 ```javascript
-var floor = require( '@stdlib/math/base/special/floor' );
-
 function accessor( v ) {
     return v * 2.0;
 }
 
 var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
-var N = floor( x.length / 2 );
 
-var v = rangeBy( N, x, 2, accessor );
+var v = rangeBy( 4, x, 2, accessor );
 // returns 12.0
 ```
 
@@ -109,7 +106,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [
 
 ```javascript
 var Float64Array = require( '@stdlib/array/float64' );
-var floor = require( '@stdlib/math/base/special/floor' );
 
 function accessor( v ) {
     return v * 2.0;
@@ -120,16 +116,15 @@ var x0 = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
 
 // Create an offset view...
 var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
-var N = floor( x0.length/2 );
 
 // Access every other element...
-var v = rangeBy( N, x1, 2, accessor );
+var v = rangeBy( 3, x1, 2, accessor );
 // returns 8.0
 ```
 
-#### rangeBy.ndarray( N, x, stride, offset, clbk\[, thisArg] )
+#### rangeBy.ndarray( N, x, strideX, offsetX, clbk\[, thisArg] )
 
-Calculates the [range][range] of strided array `x` via a callback function and using alternative indexing semantics.
+Computes the [range][range] of a strided array via a callback function and using alternative indexing semantics.
 
 ```javascript
 function accessor( v ) {
@@ -144,9 +139,9 @@ var v = rangeBy.ndarray( x.length, x, 1, 0, accessor );
 
 The function has the following additional parameters:
 
--   **offset**: starting index.
+-   **offsetX**: starting index.
 
-While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of `x`
+While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements of `x`
 
 ```javascript
 function accessor( v ) {
@@ -170,6 +165,7 @@ var v = rangeBy.ndarray( 3, x, 1, x.length-3, accessor );
 -   If `N <= 0`, both functions return `NaN`.
 -   A provided callback function should return a numeric value.
 -   If a provided callback function does not return any value (or equivalently, explicitly returns `undefined`), the value is **ignored**.
+-   Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
 -   When possible, prefer using [`drange`][@stdlib/stats/strided/drange], [`srange`][@stdlib/stats/strided/srange], and/or [`range`][@stdlib/stats/base/range], as, depending on the environment, these interfaces are likely to be significantly more performant.
 
 </section>
@@ -183,15 +179,16 @@ var v = rangeBy.ndarray( 3, x, 1, x.length-3, accessor );
 <!-- eslint no-undef: "error" -->
 
 ```javascript
-var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
 var rangeBy = require( '@stdlib/stats/base/range-by' );
 
 function accessor( v ) {
     return v * 2.0;
 }
 
-var x = filledarrayBy( 10, 'float64', discreteUniform( -50, 50 ) );
+var x = discreteUniform( 10, -50, 50, {
+    'dtype': 'float64'
+});
 console.log( x );
 
 var v = rangeBy( x.length, x, 1, accessor );
@@ -231,6 +228,8 @@ console.log( v );
 
 [mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
 
+[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor
+
 <!-- <related-links> -->
 
 [@stdlib/stats/strided/drange]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/strided/drange
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.js
index 17e8ef1c2c19..d29e87925f27 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.js
@@ -21,11 +21,18 @@
 // MODULES //
 
 var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/array/uniform' );
 var isnan = require( '@stdlib/math/base/assert/is-nan' );
 var pow = require( '@stdlib/math/base/special/pow' );
 var pkg = require( './../package.json' ).name;
-var rangeBy = require( './../lib/range_by.js' );
+var rangeBy = require( './../lib/main.js' );
+
+
+// VARIABLES //
+
+var options = {
+	'dtype': 'generic'
+};
 
 
 // FUNCTIONS //
@@ -49,13 +56,7 @@ function accessor( value ) {
 * @returns {Function} benchmark function
 */
 function createBenchmark( len ) {
-	var x;
-	var i;
-
-	x = [];
-	for ( i = 0; i < len; i++ ) {
-		x.push( ( randu()*20.0 ) - 10.0 );
-	}
+	var x = uniform( len, -10, 10, options );
 	return benchmark;
 
 	function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.ndarray.js
index 427ab185fd51..7fcc4c339195 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/benchmark/benchmark.ndarray.js
@@ -21,13 +21,20 @@
 // MODULES //
 
 var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/array/uniform' );
 var isnan = require( '@stdlib/math/base/assert/is-nan' );
 var pow = require( '@stdlib/math/base/special/pow' );
 var pkg = require( './../package.json' ).name;
 var rangeBy = require( './../lib/ndarray.js' );
 
 
+// VARIABLES //
+
+var options = {
+	'dtype': 'generic'
+};
+
+
 // FUNCTIONS //
 
 /**
@@ -49,13 +56,7 @@ function accessor( value ) {
 * @returns {Function} benchmark function
 */
 function createBenchmark( len ) {
-	var x;
-	var i;
-
-	x = [];
-	for ( i = 0; i < len; i++ ) {
-		x.push( ( randu()*20.0 ) - 10.0 );
-	}
+	var x = uniform( len, -10, 10, options );
 	return benchmark;
 
 	function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/range-by/docs/repl.txt
index a5427e4d614e..a8fbaef83d61 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/docs/repl.txt
+++ b/lib/node_modules/@stdlib/stats/base/range-by/docs/repl.txt
@@ -1,9 +1,9 @@
 
-{{alias}}( N, x, stride, clbk[, thisArg] )
-    Calculates the range of a strided array via a callback function.
+{{alias}}( N, x, strideX, clbk[, thisArg] )
+    Computes the range of a strided array via a callback function.
 
-    The `N` and `stride` parameters determine which elements in `x` are accessed
-    at runtime.
+    The `N` and stride parameters determine which elements in the strided array
+    are accessed at runtime.
 
     Indexing is relative to the first index. To introduce an offset, use typed
     array views.
@@ -31,8 +31,8 @@
         Input array/collection. If provided an object, the object must be array-
         like (excluding strings and functions).
 
-    stride: integer
-        Index increment for `x`.
+    strideX: integer
+        Stride length.
 
     clbk: Function
         Callback function.
@@ -53,25 +53,24 @@
     > {{alias}}( x.length, x, 1, accessor )
     18.0
 
-    // Using `N` and `stride` parameters:
+    // Using `N` and stride parameters:
     > x = [ -2.0, 1.0, 3.0, -5.0, 4.0, -1.0, -3.0 ];
-    > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
-    > {{alias}}( N, x, 2, accessor )
+    > {{alias}}( 3, x, 2, accessor )
     12.0
 
     // Using view offsets:
     > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] );
     > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
-    > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
-    > {{alias}}( N, x1, 2, accessor )
+    > {{alias}}( 3, x1, 2, accessor )
     8.0
 
-{{alias}}.ndarray( N, x, stride, offset, clbk[, thisArg] )
+
+{{alias}}.ndarray( N, x, strideX, offsetX, clbk[, thisArg] )
     Calculates the range of a strided array via a callback function and using
     alternative indexing semantics.
 
     While typed array views mandate a view offset based on the underlying
-    buffer, the `offset` parameter supports indexing semantics based on a
+    buffer, the offset parameter supports indexing semantics based on a
     starting index.
 
     Parameters
@@ -83,11 +82,11 @@
         Input array/collection. If provided an object, the object must be array-
         like (excluding strings and functions).
 
-    stride: integer
-        Index increment for `x`.
+    strideX: integer
+        Stride length.
 
-    offset: integer
-        Starting index of `x`.
+    offsetX: integer
+        Starting index.
 
     clbk: Function
         Callback function.
@@ -110,8 +109,7 @@
 
     // Using an index offset:
     > x = [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ];
-    > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
-    > {{alias}}.ndarray( N, x, 2, 1, accessor )
+    > {{alias}}.ndarray( 3, x, 2, 1, accessor )
     8.0
 
     See Also
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/range-by/docs/types/index.d.ts
index ee65d0f01b7b..d27183de4d5c 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/stats/base/range-by/docs/types/index.d.ts
@@ -20,7 +20,12 @@
 
 /// <reference types="@stdlib/types"/>
 
-import { Collection } from '@stdlib/types/array';
+import { Collection, AccessorArrayLike } from '@stdlib/types/array';
+
+/**
+* Input array.
+*/
+type InputArray<T> = Collection<T> | AccessorArrayLike<T>;
 
 /**
 * Returns an accessed value.
@@ -83,7 +88,7 @@ type Callback<T, U> = Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U> |
 */
 interface Routine {
 	/**
-	* Calculates the range of a strided array via a callback function.
+	* Computes the range of a strided array via a callback function.
 	*
 	* ## Notes
 	*
@@ -98,7 +103,7 @@ interface Routine {
 	*
 	* @param N - number of indexed elements
 	* @param x - input array
-	* @param stride - stride length
+	* @param strideX - stride length
 	* @param clbk - callback
 	* @param thisArg - execution context
 	* @returns range
@@ -113,10 +118,10 @@ interface Routine {
 	* var v = rangeBy( x.length, x, 1, accessor );
 	* // returns 18.0
 	*/
-	<T = unknown, U = unknown>( N: number, x: Collection<T>, stride: number, clbk: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ): number;
+	<T = unknown, U = unknown>( N: number, x: InputArray<T>, strideX: number, clbk: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ): number;
 
 	/**
-	* Calculates the range of a strided array via a callback function and using alternative indexing semantics.
+	* Computes the range of a strided array via a callback function and using alternative indexing semantics.
 	*
 	* ## Notes
 	*
@@ -131,8 +136,8 @@ interface Routine {
 	*
 	* @param N - number of indexed elements
 	* @param x - input array
-	* @param stride - stride length
-	* @param offset - starting index
+	* @param strideX - stride length
+	* @param offsetX - starting index
 	* @param clbk - callback
 	* @param thisArg - execution context
 	* @returns range
@@ -147,11 +152,11 @@ interface Routine {
 	* var v = rangeBy.ndarray( x.length, x, 1, 0, accessor );
 	* // returns 18.0
 	*/
-	ndarray<T = unknown, U = unknown>( N: number, x: Collection<T>, stride: number, offset: number, clbk: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ): number;
+	ndarray<T = unknown, U = unknown>( N: number, x: InputArray<T>, strideX: number, offsetX: number, clbk: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ): number;
 }
 
 /**
-* Calculates the range of a strided array via a callback function.
+* Computes the range of a strided array via a callback function.
 *
 * ## Notes
 *
@@ -166,7 +171,7 @@ interface Routine {
 *
 * @param N - number of indexed elements
 * @param x - input array
-* @param stride - stride length
+* @param strideX - stride length
 * @param clbk - callback
 * @param thisArg - execution context
 * @returns range
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/examples/index.js b/lib/node_modules/@stdlib/stats/base/range-by/examples/index.js
index 2c25e656bb8b..91cb5a8d1c92 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/examples/index.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/examples/index.js
@@ -18,15 +18,16 @@
 
 'use strict';
 
-var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
-var filledarrayBy = require( '@stdlib/array/filled-by' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
 var rangeBy = require( './../lib' );
 
 function accessor( v ) {
 	return v * 2.0;
 }
 
-var x = filledarrayBy( 10, 'float64', discreteUniform( -50, 50 ) );
+var x = discreteUniform( 10, -50, 50, {
+	'dtype': 'float64'
+});
 console.log( x );
 
 var v = rangeBy( x.length, x, 1, accessor );
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/lib/range_by.js b/lib/node_modules/@stdlib/stats/base/range-by/lib/accessors.js
similarity index 56%
rename from lib/node_modules/@stdlib/stats/base/range-by/lib/range_by.js
rename to lib/node_modules/@stdlib/stats/base/range-by/lib/accessors.js
index b4c87ca8271c..d9f95e3aa0d6 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/lib/range_by.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/lib/accessors.js
@@ -1,7 +1,7 @@
 /**
 * @license Apache-2.0
 *
-* Copyright (c) 2020 The Stdlib Authors.
+* Copyright (c) 2025 The Stdlib Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -26,53 +26,60 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
 // MAIN //
 
 /**
-* Calculates the range of a strided array via a callback function.
+* Computes the range of a strided array via a callback function.
 *
 * @param {PositiveInteger} N - number of indexed elements
-* @param {Collection} x - input array/collection
-* @param {integer} stride - index increment
+* @param {Object} x - input array object
+* @param {Collection} x.data - input array data
+* @param {Array<Function>} x.accessors - array element accessors
+* @param {integer} strideX - stride length
+* @param {NonNegativeInteger} offsetX - starting index
 * @param {Callback} clbk - callback
 * @param {*} [thisArg] - execution context
 * @returns {number} range
 *
 * @example
-* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+* var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
+*
+* var x = toAccessorArray( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] );
 *
 * function accessor( v ) {
 *     return v * 2.0;
 * }
 *
-* var v = rangeBy( x.length, x, 1, accessor );
+* var v = rangeBy( x.length, arraylike2object( x ), 1, 0, accessor );
 * // returns 18.0
 */
-function rangeBy( N, x, stride, clbk, thisArg ) {
+function rangeBy( N, x, strideX, offsetX, clbk, thisArg) {
+	var xbuf;
+	var get;
 	var max;
 	var min;
 	var ix;
 	var v;
 	var i;
 
-	if ( N <= 0 ) {
-		return NaN;
-	}
-	if ( N === 1 || stride === 0 ) {
-		v = clbk.call( thisArg, x[ 0 ], 0, 0, x );
+	// Cache reference to array data:
+	xbuf = x.data;
+
+	// Cache a reference to the element accessor:
+	get = x.accessors[ 0 ];
+
+	if ( N === 1 || strideX === 0 ) {
+		v = clbk.call( thisArg, get( xbuf, offsetX ), 0, offsetX, x );
 		if ( v === void 0 || isnan( v ) ) {
 			return NaN;
 		}
 		return 0.0;
 	}
-	if ( stride < 0 ) {
-		ix = (1-N) * stride;
-	} else {
-		ix = 0;
-	}
+	ix = offsetX;
 	for ( i = 0; i < N; i++ ) {
-		min = clbk.call( thisArg, x[ ix ], i, ix, x );
+		min = clbk.call( thisArg, get( xbuf, ix ), i, ix, x );
 		if ( min !== void 0 ) {
 			break;
 		}
-		ix += stride;
+		ix += strideX;
 	}
 	if ( i === N ) {
 		return NaN;
@@ -80,8 +87,8 @@ function rangeBy( N, x, stride, clbk, thisArg ) {
 	max = min;
 	i += 1;
 	for ( i; i < N; i++ ) {
-		ix += stride;
-		v = clbk.call( thisArg, x[ ix ], i, ix, x );
+		ix += strideX;
+		v = clbk.call( thisArg, get( xbuf, ix ), i, ix, x );
 		if ( v === void 0 ) {
 			continue;
 		}
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/lib/index.js b/lib/node_modules/@stdlib/stats/base/range-by/lib/index.js
index dfc0f442b883..be82110978f0 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/lib/index.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/lib/index.js
@@ -19,7 +19,7 @@
 'use strict';
 
 /**
-* Calculate the range of a strided array via a callback function.
+* Compute the range of a strided array via a callback function.
 *
 * @module @stdlib/stats/base/range-by
 *
@@ -50,7 +50,14 @@
 
 // MODULES //
 
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
 var main = require( './main.js' );
+var ndarray = require( './ndarray.js' );
+
+
+// MAIN //
+
+setReadOnly( main, 'ndarray', ndarray );
 
 
 // EXPORTS //
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/lib/main.js b/lib/node_modules/@stdlib/stats/base/range-by/lib/main.js
index 237cd1ff444b..c1a35bc4202f 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/lib/main.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/lib/main.js
@@ -20,14 +20,35 @@
 
 // MODULES //
 
-var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
-var rangeBy = require( './range_by.js' );
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
 var ndarray = require( './ndarray.js' );
 
 
 // MAIN //
 
-setReadOnly( rangeBy, 'ndarray', ndarray );
+/**
+* Computes the range of a strided array via a callback function.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @param {Collection} x - input array
+* @param {integer} strideX - index increment
+* @param {Callback} clbk - callback
+* @param {*} [thisArg] - execution context
+* @returns {number} range
+*
+* @example
+* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* function accessor( v ) {
+*     return v * 2.0;
+* }
+*
+* var v = rangeBy( x.length, x, 1, accessor );
+* // returns 18.0
+*/
+function rangeBy( N, x, strideX, clbk, thisArg ) {
+	return ndarray( N, x, strideX, stride2offset( N, strideX ), clbk, thisArg );
+}
 
 
 // EXPORTS //
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/range-by/lib/ndarray.js
index dbad088a497d..a6d6bd627310 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/lib/ndarray.js
@@ -21,17 +21,19 @@
 // MODULES //
 
 var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
+var accessors = require( './accessors.js' );
 
 
 // MAIN //
 
 /**
-* Calculates the range of a strided array via a callback function.
+* Computes the range of a strided array via a callback function.
 *
 * @param {PositiveInteger} N - number of indexed elements
-* @param {Collection} x - input array/collection
-* @param {integer} stride - index increment
-* @param {NonNegativeInteger} offset - starting index
+* @param {Collection} x - input array
+* @param {integer} strideX - stride length
+* @param {NonNegativeInteger} offsetX - starting index
 * @param {Callback} clbk - callback
 * @param {*} [thisArg] - execution context
 * @returns {number} range
@@ -46,30 +48,35 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
 * var v = rangeBy( x.length, x, 1, 0, accessor );
 * // returns 18.0
 */
-function rangeBy( N, x, stride, offset, clbk, thisArg ) {
+function rangeBy( N, x, strideX, offsetX, clbk, thisArg ) {
 	var max;
 	var min;
 	var ix;
 	var v;
 	var i;
+	var o;
 
 	if ( N <= 0 ) {
 		return NaN;
 	}
-	if ( N === 1 || stride === 0 ) {
-		v = clbk.call( thisArg, x[ 0 ], 0, 0, x );
+	o = arraylike2object( x );
+	if ( o.accessorProtocol ) {
+		return accessors( N, o, strideX, offsetX, clbk, thisArg );
+	}
+	if ( N === 1 || strideX === 0 ) {
+		v = clbk.call( thisArg, x[ offsetX ], 0, offsetX, x );
 		if ( v === void 0 || isnan( v ) ) {
 			return NaN;
 		}
 		return 0.0;
 	}
-	ix = offset;
+	ix = offsetX;
 	for ( i = 0; i < N; i++ ) {
 		min = clbk.call( thisArg, x[ ix ], i, ix, x );
 		if ( min !== void 0 ) {
 			break;
 		}
-		ix += stride;
+		ix += strideX;
 	}
 	if ( i === N ) {
 		return NaN;
@@ -77,7 +84,7 @@ function rangeBy( N, x, stride, offset, clbk, thisArg ) {
 	max = min;
 	i += 1;
 	for ( i; i < N; i++ ) {
-		ix += stride;
+		ix += strideX;
 		v = clbk.call( thisArg, x[ ix ], i, ix, x );
 		if ( v === void 0 ) {
 			continue;


Test patch:
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/range-by/docs/types/test.ts
index f1f5674896d9..20154cdde8d2 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/docs/types/test.ts
+++ b/lib/node_modules/@stdlib/stats/base/range-by/docs/types/test.ts
@@ -16,6 +16,7 @@
 * limitations under the License.
 */
 
+import AccessorArray = require( '@stdlib/array/base/accessor' );
 import rangeBy = require( './index' );
 
 const accessor = (): number => {
@@ -30,7 +31,10 @@ const accessor = (): number => {
 	const x = new Float64Array( 10 );
 
 	rangeBy( x.length, x, 1, accessor ); // $ExpectType number
+	rangeBy( x.length, new AccessorArray ( x ), 1, accessor ); // $ExpectType number
+
 	rangeBy( x.length, x, 1, accessor, {} ); // $ExpectType number
+	rangeBy( x.length, new AccessorArray ( x ), 1, accessor, {} ); // $ExpectType number
 }
 
 // The compiler throws an error if the function is provided a first argument which is not a number...
@@ -70,7 +74,7 @@ const accessor = (): number => {
 	rangeBy( x.length, x, undefined, accessor ); // $ExpectError
 	rangeBy( x.length, x, [], accessor ); // $ExpectError
 	rangeBy( x.length, x, {}, accessor ); // $ExpectError
-	rangeBy( x.length, x, ( x: number, accessor ): number => x, accessor ); // $ExpectError
+	rangeBy( x.length, x, ( x: number ): number => x, accessor ); // $ExpectError
 }
 
 // The compiler throws an error if the function is provided a fourth argument which is not a function...
@@ -102,7 +106,10 @@ const accessor = (): number => {
 	const x = new Float64Array( 10 );
 
 	rangeBy.ndarray( x.length, x, 1, 0, accessor ); // $ExpectType number
+	rangeBy.ndarray( x.length, new AccessorArray ( x ), 1, 0, accessor ); // $ExpectType number
+
 	rangeBy.ndarray( x.length, x, 1, 0, accessor, {} ); // $ExpectType number
+	rangeBy.ndarray( x.length, new AccessorArray ( x ), 1, 0, accessor, {} ); // $ExpectType number
 }
 
 // The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/test/test.range_by.js b/lib/node_modules/@stdlib/stats/base/range-by/test/test.main.js
similarity index 50%
rename from lib/node_modules/@stdlib/stats/base/range-by/test/test.range_by.js
rename to lib/node_modules/@stdlib/stats/base/range-by/test/test.main.js
index aa3a295b2547..2f3f078803b1 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/test/test.range_by.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/test/test.main.js
@@ -21,11 +21,11 @@
 // MODULES //
 
 var tape = require( 'tape' );
-var floor = require( '@stdlib/math/base/special/floor' );
 var isnan = require( '@stdlib/math/base/assert/is-nan' );
 var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
+var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
 var Float64Array = require( '@stdlib/array/float64' );
-var rangeBy = require( './../lib/range_by.js' );
+var rangeBy = require( './../lib' );
 
 
 // FUNCTIONS //
@@ -75,11 +75,11 @@ tape( 'the function calculates the range of a strided array via a callback funct
 	v = rangeBy( x.length, x, 1, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
 
-	x = new Array( 5 ); // sparse array
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
 	v = rangeBy( x.length, x, 1, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
 
-	x = new Array( 5 ); // sparse array
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
 	x[ 2 ] = 1.0;
 	v = rangeBy( x.length, x, 1, accessor );
 	t.strictEqual( v, 0.0, 'returns expected value' );
@@ -87,6 +87,42 @@ tape( 'the function calculates the range of a strided array via a callback funct
 	t.end();
 });
 
+tape( 'the function calculates the range of a strided array via a callback function (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 0.0, 3.0 ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( v, 18.0, 'returns expected value' );
+
+	x = [ -4.0, -5.0 ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( v, 2.0, 'returns expected value' );
+
+	x = [ -0.0, 0.0, -0.0 ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
+
+	x = [ NaN ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	x = [ NaN, NaN ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
+	x[ 2 ] = 1.0;
+	v = rangeBy( x.length, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( v, 0.0, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN`', function test( t ) {
 	var x;
 	var v;
@@ -102,6 +138,21 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
 	t.end();
 });
 
+tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN` (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 3.0 ];
+
+	v = rangeBy( 0, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	v = rangeBy( -1, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'if provided an `N` parameter equal to `1`, the function returns `0`', function test( t ) {
 	var x;
 	var v;
@@ -111,7 +162,7 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns `0`', fun
 	v = rangeBy( 1, x, 1, accessor );
 	t.strictEqual( v, 0.0, 'returns expected value' );
 
-	x = new Array( 1 ); // sparse array
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
 
 	v = rangeBy( 1, x, 1, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
@@ -119,8 +170,24 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns `0`', fun
 	t.end();
 });
 
+tape( 'if provided an `N` parameter equal to `1`, the function returns `0` (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 3.0 ];
+
+	v = rangeBy( 1, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( v, 0.0, 'returns expected value' );
+
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
+
+	v = rangeBy( 1, toAccessorArray( x ), 1, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'the function supports a `stride` parameter', function test( t ) {
-	var N;
 	var x;
 	var v;
 
@@ -135,15 +202,34 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
 		2.0
 	];
 
-	N = floor( x.length / 2 );
-	v = rangeBy( N, x, 2, accessor );
+	v = rangeBy( 4, x, 2, accessor );
+
+	t.strictEqual( v, 12.0, 'returns expected value' );
+	t.end();
+});
+
+tape( 'the function supports a `stride` parameter (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [
+		1.0,  // 0
+		2.0,
+		2.0,  // 1
+		-7.0,
+		-2.0, // 2
+		3.0,
+		4.0,  // 3
+		2.0
+	];
+
+	v = rangeBy( 4, toAccessorArray( x ), 2, accessor );
 
 	t.strictEqual( v, 12.0, 'returns expected value' );
 	t.end();
 });
 
 tape( 'the function supports a negative `stride` parameter', function test( t ) {
-	var N;
 	var x;
 	var v;
 
@@ -158,8 +244,27 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
 		2.0
 	];
 
-	N = floor( x.length / 2 );
-	v = rangeBy( N, x, -2, accessor );
+	v = rangeBy( 4, x, -2, accessor );
+
+	t.strictEqual( v, 12.0, 'returns expected value' );
+	t.end();
+});
+tape( 'the function supports a negative `stride` parameter (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [
+		1.0,  // 3
+		2.0,
+		2.0,  // 2
+		-7.0,
+		-2.0, // 1
+		3.0,
+		4.0,  // 0
+		2.0
+	];
+
+	v = rangeBy( 4, toAccessorArray( x ), -2, accessor );
 
 	t.strictEqual( v, 12.0, 'returns expected value' );
 	t.end();
@@ -174,7 +279,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
 	v = rangeBy( x.length, x, 0, accessor );
 	t.strictEqual( v, 0.0, 'returns expected value' );
 
-	x = new Array( 1 ); // sparse array
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
 
 	v = rangeBy( 1, x, 0, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
@@ -182,10 +287,26 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
 	t.end();
 });
 
+tape( 'if provided a `stride` parameter equal to `0`, the function returns `0` (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 3.0 ];
+
+	v = rangeBy( x.length, toAccessorArray( x ), 0, accessor );
+	t.strictEqual( v, 0.0, 'returns expected value' );
+
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
+
+	v = rangeBy( 1, toAccessorArray( x ), 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'the function supports view offsets', function test( t ) {
 	var x0;
 	var x1;
-	var N;
 	var v;
 
 	x0 = new Float64Array([
@@ -201,9 +322,33 @@ tape( 'the function supports view offsets', function test( t ) {
 	]);
 
 	x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
-	N = floor(x1.length / 2);
 
-	v = rangeBy( N, x1, 2, accessor );
+	v = rangeBy( 4, x1, 2, accessor );
+	t.strictEqual( v, 12.0, 'returns expected value' );
+
+	t.end();
+});
+
+tape( 'the function supports view offsets (accessors)', function test( t ) {
+	var x0;
+	var x1;
+	var v;
+
+	x0 = new Float64Array([
+		2.0,
+		1.0,  // 0
+		2.0,
+		-2.0, // 1
+		-2.0,
+		2.0,  // 2
+		3.0,
+		4.0,  // 3
+		6.0
+	]);
+
+	x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
+
+	v = rangeBy( 4, toAccessorArray( x1 ), 2, accessor );
 	t.strictEqual( v, 12.0, 'returns expected value' );
 
 	t.end();
@@ -227,3 +372,22 @@ tape( 'the function supports providing a callback execution context', function t
 		return v * 2.0;
 	}
 });
+
+tape( 'the function supports providing a callback execution context (accessors)', function test( t ) {
+	var ctx;
+	var x;
+
+	x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
+	ctx = {
+		'count': 0
+	};
+	rangeBy( x.length, toAccessorArray( x ), 1, accessor, ctx );
+
+	t.strictEqual( ctx.count, x.length, 'returns expected value' );
+	t.end();
+
+	function accessor( v ) {
+		this.count += 1; // eslint-disable-line no-invalid-this
+		return v * 2.0;
+	}
+});
diff --git a/lib/node_modules/@stdlib/stats/base/range-by/test/test.ndarray.js b/lib/node_modules/@stdlib/stats/base/range-by/test/test.ndarray.js
index 4dfd226b7998..e77995c7c7aa 100644
--- a/lib/node_modules/@stdlib/stats/base/range-by/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/range-by/test/test.ndarray.js
@@ -21,9 +21,9 @@
 // MODULES //
 
 var tape = require( 'tape' );
-var floor = require( '@stdlib/math/base/special/floor' );
 var isnan = require( '@stdlib/math/base/assert/is-nan' );
 var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
+var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
 var rangeBy = require( './../lib/ndarray.js' );
 
 
@@ -74,11 +74,11 @@ tape( 'the function calculates the range of a strided array via a callback funct
 	v = rangeBy( x.length, x, 1, 0, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
 
-	x = new Array( 5 ); // sparse array
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
 	v = rangeBy( x.length, x, 1, 0, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
 
-	x = new Array( 5 ); // sparse array
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
 	x[ 2 ] = 1.0;
 	v = rangeBy( x.length, x, 1, 0, accessor );
 	t.strictEqual( v, 0.0, 'returns expected value' );
@@ -86,6 +86,42 @@ tape( 'the function calculates the range of a strided array via a callback funct
 	t.end();
 });
 
+tape( 'the function calculates the range of a strided array via a callback function (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 0.0, 3.0 ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( v, 18.0, 'returns expected value' );
+
+	x = [ -4.0, -5.0 ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( v, 2.0, 'returns expected value' );
+
+	x = [ -0.0, 0.0, -0.0 ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
+
+	x = [ NaN ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	x = [ NaN, NaN ];
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	x = new Array( 5 ); // eslint-disable-line stdlib/no-new-array
+	x[ 2 ] = 1.0;
+	v = rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( v, 0.0, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN`', function test( t ) {
 	var x;
 	var v;
@@ -101,6 +137,21 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
 	t.end();
 });
 
+tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN` (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 3.0 ];
+
+	v = rangeBy( 0, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	v = rangeBy( -1, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'if provided an `N` parameter equal to `1`, the function returns `0`', function test( t ) {
 	var x;
 	var v;
@@ -110,7 +161,7 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns `0`', fun
 	v = rangeBy( 1, x, 1, 0, accessor );
 	t.strictEqual( v, 0.0, 'returns expected value' );
 
-	x = new Array( 1 ); // sparse array
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
 
 	v = rangeBy( 1, x, 1, 0, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
@@ -118,8 +169,24 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns `0`', fun
 	t.end();
 });
 
+tape( 'if provided an `N` parameter equal to `1`, the function returns `0` (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 3.0 ];
+
+	v = rangeBy( 1, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( v, 0.0, 'returns expected value' );
+
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
+
+	v = rangeBy( 1, toAccessorArray( x ), 1, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'the function supports a `stride` parameter', function test( t ) {
-	var N;
 	var x;
 	var v;
 
@@ -134,15 +201,34 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
 		2.0
 	];
 
-	N = floor( x.length / 2 );
-	v = rangeBy( N, x, 2, 0, accessor );
+	v = rangeBy( 4, x, 2, 0, accessor );
+
+	t.strictEqual( v, 12.0, 'returns expected value' );
+	t.end();
+});
+
+tape( 'the function supports a `stride` parameter (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [
+		1.0,  // 0
+		2.0,
+		2.0,  // 1
+		-7.0,
+		-2.0, // 2
+		3.0,
+		4.0,  // 3
+		2.0
+	];
+
+	v = rangeBy( 4, toAccessorArray( x ), 2, 0, accessor );
 
 	t.strictEqual( v, 12.0, 'returns expected value' );
 	t.end();
 });
 
 tape( 'the function supports a negative `stride` parameter', function test( t ) {
-	var N;
 	var x;
 	var v;
 
@@ -157,8 +243,28 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
 		2.0
 	];
 
-	N = floor( x.length / 2 );
-	v = rangeBy( N, x, -2, 6, accessor );
+	v = rangeBy( 4, x, -2, 6, accessor );
+
+	t.strictEqual( v, 12.0, 'returns expected value' );
+	t.end();
+});
+
+tape( 'the function supports a negative `stride` parameter (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [
+		1.0,  // 3
+		2.0,
+		2.0,  // 2
+		-7.0,
+		-2.0, // 1
+		3.0,
+		4.0,  // 0
+		2.0
+	];
+
+	v = rangeBy( 4, toAccessorArray( x ), -2, 6, accessor );
 
 	t.strictEqual( v, 12.0, 'returns expected value' );
 	t.end();
@@ -173,7 +279,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
 	v = rangeBy( x.length, x, 0, 0, accessor );
 	t.strictEqual( v, 0.0, 'returns expected value' );
 
-	x = new Array( 1 ); // sparse array
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
 
 	v = rangeBy( 1, x, 0, 0, accessor );
 	t.strictEqual( isnan( v ), true, 'returns expected value' );
@@ -181,6 +287,23 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
 	t.end();
 });
 
+tape( 'if provided a `stride` parameter equal to `0`, the function returns `0` (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [ 1.0, -2.0, -4.0, 5.0, 3.0 ];
+
+	v = rangeBy( x.length, toAccessorArray( x ), 0, 0, accessor );
+	t.strictEqual( v, 0.0, 'returns expected value' );
+
+	x = new Array( 1 ); // eslint-disable-line stdlib/no-new-array
+
+	v = rangeBy( 1, toAccessorArray( x ), 0, 0, accessor );
+	t.strictEqual( isnan( v ), true, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'the function supports an offset parameter', function test( t ) {
 	var x;
 	var v;
@@ -200,6 +323,25 @@ tape( 'the function supports an offset parameter', function test( t ) {
 	t.end();
 });
 
+tape( 'the function supports an offset parameter (accessors)', function test( t ) {
+	var x;
+	var v;
+
+	x = [
+		1.0,
+		-2.0, // 0
+		3.0,
+		4.0,  // 1
+		5.0,
+		-6.0  // 2
+	];
+
+	v = rangeBy( 3, toAccessorArray( x ), 2, 1, accessor );
+	t.strictEqual( v, 20.0, 'returns expected value' );
+
+	t.end();
+});
+
 tape( 'the function supports providing a callback execution context', function test( t ) {
 	var ctx;
 	var x;
@@ -218,3 +360,22 @@ tape( 'the function supports providing a callback execution context', function t
 		return v * 2.0;
 	}
 });
+
+tape( 'the function supports providing a callback execution context (accessors)', function test( t ) {
+	var ctx;
+	var x;
+
+	x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
+	ctx = {
+		'count': 0
+	};
+	rangeBy( x.length, toAccessorArray( x ), 1, 0, accessor, ctx );
+
+	t.strictEqual( ctx.count, x.length, 'returns expected value' );
+	t.end();
+
+	function accessor( v ) {
+		this.count += 1; // eslint-disable-line no-invalid-this
+		return v * 2.0;
+	}
+});