From 5a52c8e4a017ce5cee16605dafe8a414b2aa1cbf Mon Sep 17 00:00:00 2001 From: headlessNode Date: Wed, 25 Mar 2026 19:17:37 +0500 Subject: [PATCH 01/10] feat: add blas/ext/base/gjoin-between --- .../blas/ext/base/gjoin-between/README.md | 195 ++++++++++++ .../base/gjoin-between/benchmark/benchmark.js | 99 ++++++ .../benchmark/benchmark.ndarray.js | 99 ++++++ .../blas/ext/base/gjoin-between/docs/repl.txt | 104 ++++++ .../base/gjoin-between/docs/types/index.d.ts | 110 +++++++ .../ext/base/gjoin-between/docs/types/test.ts | 296 ++++++++++++++++++ .../ext/base/gjoin-between/examples/index.js | 32 ++ .../ext/base/gjoin-between/lib/accessors.js | 97 ++++++ .../blas/ext/base/gjoin-between/lib/index.js | 59 ++++ .../blas/ext/base/gjoin-between/lib/main.js | 60 ++++ .../ext/base/gjoin-between/lib/ndarray.js | 89 ++++++ .../blas/ext/base/gjoin-between/package.json | 66 ++++ .../blas/ext/base/gjoin-between/test/test.js | 38 +++ .../ext/base/gjoin-between/test/test.main.js | 156 +++++++++ .../base/gjoin-between/test/test.ndarray.js | 168 ++++++++++ 15 files changed, 1668 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md new file mode 100644 index 000000000000..45d7a895ceb0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md @@ -0,0 +1,195 @@ + + +# gjoinBetween + +> Return a string created by joining strided array elements using specified separators between consecutive elements. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var gjoinBetween = require( '@stdlib/blas/ext/base/gjoin-between' ); +``` + +#### gjoinBetween( N, prefix, suffix, x, strideX, separators, strideS ) + +Returns a string created by joining strided array elements using specified separators between consecutive elements. + +```javascript +var x = [ 1, 2, 3, 4 ]; +var sep = [ ' + ', ' - ', ' != ' ]; + +var str = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); +// returns 'op: 1 + 2 - 3 != 4' +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **prefix**: string to prepend to the output string. +- **suffix**: string to append to the output string. +- **x**: input array. +- **strideX**: stride length for `x`. +- **separators**: separators array. +- **strideS**: stride length for `separators`. + +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to join every other element: + +```javascript +var x = [ 1, 2, 3, 4, 5, 6 ]; +var sep = [ ',', '-' ]; + +var str = gjoinBetween( 3, '', '', x, 2, sep, 1 ); +// returns '1,3-5' +``` + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial array: +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 + +// Join elements: +var sep = [ ' | ', ' | ' ]; +var str = gjoinBetween( 3, '[', ']', x1, 2, sep, 1 ); +// returns '[2 | 4 | 6]' +``` + + + +#### gjoinBetween.ndarray( N, prefix, suffix, x, strideX, offsetX, separators, strideS, offsetS ) + + + +Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. + +```javascript +var x = [ 1, 2, 3, 4 ]; +var sep = [ ' + ', ' - ', ' != ' ]; + +var str = gjoinBetween.ndarray( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); +// returns 'op: 1 + 2 - 3 != 4' +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. +- **offsetS**: starting index for `separators`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to access only the last three elements of the strided array: + +```javascript +var x = [ 1, 2, 3, 4, 5, 6 ]; +var sep = [ ' | ', ' | ' ]; + +var str = gjoinBetween.ndarray( 3, '[ ', ' ]', x, 1, x.length-3, sep, 1, 0 ); +// returns '[ 4 | 5 | 6 ]' +``` + +
+ + + + + +
+ +## Notes + +- If `N <= 0`, both functions return the prefix and suffix joined together. +- The `separators` array is assumed to have at least `N-1` elements (i.e., equal to the number of "gaps" between consecutive elements). +- If an array element is either `null` or `undefined`, both functions will serialize the element as an empty string. +- 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]). + +
+ + + + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var filled = require( '@stdlib/array/base/filled' ); +var gjoinBetween = require( '@stdlib/blas/ext/base/gjoin-between' ); + +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( x ); + +var sep = filled( ' | ', x.length - 1 ); +var out = gjoinBetween( x.length, '[ ', ' ]', x, 1, sep, 1 ); +console.log( out ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js new file mode 100644 index 000000000000..b6c67d145e95 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js @@ -0,0 +1,99 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var oneTo = require( '@stdlib/array/one-to' ); +var filled = require( '@stdlib/array/base/filled' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gjoinBetween = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var sep = filled( ',', len - 1 ); + var x = oneTo( len, 'float64' ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = gjoinBetween( x.length, '', '', x, 1, sep, 1 ); + if ( out !== out ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..6fb737a740d7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js @@ -0,0 +1,99 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isString = require( '@stdlib/assert/is-string' ).isPrimitive; +var oneTo = require( '@stdlib/array/one-to' ); +var filled = require( '@stdlib/array/base/filled' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gjoinBetween = require( './../lib/ndarray.js' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var sep = filled( ',', len - 1 ); + var x = oneTo( len, 'float64' ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = gjoinBetween( x.length, '', '', x, 1, 0, sep, 1, 0 ); + if ( out !== out ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( out ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + + f = createBenchmark( len ); + bench( format( '%s:ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt new file mode 100644 index 000000000000..506782f5a478 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt @@ -0,0 +1,104 @@ + +{{alias}}( N, prefix, suffix, x, strideX, separators, strideS ) + Returns a string created by joining strided array elements using specified + separators between consecutive elements. + + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use a typed + array view. + + If `N <= 0`, the function returns the prefix and suffix joined together. + + If an array element is either `null` or `undefined`, the function will + serialize the element as an empty string. + + Parameters + ---------- + N: integer + Number of indexed elements. + + prefix: string + String to prepend to the output string. + + suffix: string + String to append to the output string. + + x: Array|TypedArray + Input array. + + strideX: integer + Stride length for `x`. + + separators: Array + Separators array. + + strideS: integer + Stride length for `separators`. + + Returns + ------- + str: string + Joined string. + + Examples + -------- + > var x = [ 1, 2, 3, 4 ]; + > var sep = [ ' + ', ' - ', ' != ' ]; + > var str = {{alias}}( x.length, 'op: ', '', x, 1, sep, 1 ) + 'op: 1 + 2 - 3 != 4' + + +{{alias}}.ndarray( N, prefix, suffix, x, strideX, offsetX, separators, ss, os ) + Returns a string created by joining strided array elements using specified + separators between consecutive elements and alternative indexing + semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on + starting indices. + + Parameters + ---------- + N: integer + Number of indexed elements. + + prefix: string + String to prepend to the output string. + + suffix: string + String to append to the output string. + + x: Array|TypedArray + Input array. + + strideX: integer + Stride length for `x`. + + offsetX: integer + Starting index for `x`. + + separators: Array + Separators array. + + ss: integer + Stride length for `separators`. + + os: integer + Starting index for `separators`. + + Returns + ------- + str: string + Joined string. + + Examples + -------- + > var x = [ 1, 2, 3, 4 ]; + > var sep = [ ' + ', ' - ', ' != ' ]; + > var str = {{alias}}.ndarray( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ) + 'op: 1 + 2 - 3 != 4' + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts new file mode 100644 index 000000000000..d956a2e20122 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts @@ -0,0 +1,110 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Collection, AccessorArrayLike } from '@stdlib/types/array'; + +/** +* Input array. +*/ +type InputArray = Collection | AccessorArrayLike; + +/** +* Interface describing `gjoinBetween`. +*/ +interface Routine { + /** + * Returns a string created by joining strided array elements using specified separators between consecutive elements. + * + * @param N - number of indexed elements + * @param prefix - string to prepend to the output string + * @param suffix - string to append to the output string + * @param x - input array + * @param strideX - stride length for `x` + * @param separators - separators array + * @param strideS - stride length for `separators` + * @returns joined string + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * var sep = [ ' + ', ' - ', ' != ' ]; + * + * var str = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); + * // returns 'op: 1 + 2 - 3 != 4' + */ + ( N: number, prefix: string, suffix: string, x: InputArray, strideX: number, separators: Collection, strideS: number ): string; + + /** + * Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. + * + * @param N - number of indexed elements + * @param prefix - string to prepend to the output string + * @param suffix - string to append to the output string + * @param x - input array + * @param strideX - stride length for `x` + * @param offsetX - starting index for `x` + * @param separators - separators array + * @param strideS - stride length for `separators` + * @param offsetS - starting index for `separators` + * @returns joined string + * + * @example + * var x = [ 1, 2, 3, 4 ]; + * var sep = [ ' + ', ' - ', ' != ' ]; + * + * var str = gjoinBetween.ndarray( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); + * // returns 'op: 1 + 2 - 3 != 4' + */ + ndarray( N: number, prefix: string, suffix: string, x: InputArray, strideX: number, offsetX: number, separators: Collection, strideS: number, offsetS: number ): string; +} + +/** +* Returns a string created by joining strided array elements using specified separators between consecutive elements. +* +* @param N - number of indexed elements +* @param prefix - string to prepend to the output string +* @param suffix - string to append to the output string +* @param x - input array +* @param strideX - stride length for `x` +* @param separators - separators array +* @param strideS - stride length for `separators` +* @returns joined string +* +* @example +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var str = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); +* // returns 'op: 1 + 2 - 3 != 4' +* +* @example +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var str = gjoinBetween.ndarray( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); +* // returns 'op: 1 + 2 - 3 != 4' +*/ +declare var gjoinBetween: Routine; + + +// EXPORTS // + +export = gjoinBetween; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/test.ts new file mode 100644 index 000000000000..0cc58f2b62ca --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/test.ts @@ -0,0 +1,296 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import gjoinBetween = require( './index' ); + + +// TESTS // + +// The function returns a string... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween( x.length, '', '', x, 1, sep, 1 ); // $ExpectType string +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween( '5', '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( true, '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( false, '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( null, '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( undefined, '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( [], '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( {}, '', '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( ( x: number ): number => x, '', '', x, 1, sep, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween( x.length, 5, '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, true, '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, false, '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, null, '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, undefined, '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, [], '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, {}, '', x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, ( x: number ): number => x, '', x, 1, sep, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween( x.length, '', 5, x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', true, x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', false, x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', null, x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', undefined, x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', [], x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', {}, x, 1, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', ( x: number ): number => x, x, 1, sep, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not an array-like object... +{ + const sep = [ ',', '-', '|' ]; + + gjoinBetween( 4, '', '', 5, 1, sep, 1 ); // $ExpectError + gjoinBetween( 4, '', '', true, 1, sep, 1 ); // $ExpectError + gjoinBetween( 4, '', '', false, 1, sep, 1 ); // $ExpectError + gjoinBetween( 4, '', '', null, 1, sep, 1 ); // $ExpectError + gjoinBetween( 4, '', '', undefined, 1, sep, 1 ); // $ExpectError + gjoinBetween( 4, '', '', {}, 1, sep, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween( x.length, '', '', x, '5', sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, true, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, false, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, null, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, undefined, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, [], sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, {}, sep, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, ( x: number ): number => x, sep, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not an array-like object... +{ + const x = [ 1, 2, 3, 4 ]; + + gjoinBetween( x.length, '', '', x, 1, 5, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, true, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, false, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, null, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, undefined, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, {}, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween( x.length, '', '', x, 1, sep, '5' ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, true ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, false ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, null ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, undefined ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, [] ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, {} ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided insufficient arguments... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween(); // $ExpectError + gjoinBetween( x.length ); // $ExpectError + gjoinBetween( x.length, '' ); // $ExpectError + gjoinBetween( x.length, '', '' ); // $ExpectError + gjoinBetween( x.length, '', '', x ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1 ); // $ExpectError + gjoinBetween( x.length, '', '', x, 1, sep ); // $ExpectError +} + +// Attached to the main export is an `ndarray` method which returns a string... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectType string +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( '5', '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( true, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( false, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( null, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( undefined, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( [], '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( {}, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( ( x: number ): number => x, '', '', x, 1, 0, sep, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a string... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, 5, '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, true, '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, false, '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, null, '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, undefined, '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, [], '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, {}, '', x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, ( x: number ): number => x, '', x, 1, 0, sep, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a string... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, '', 5, x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', true, x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', false, x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', null, x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', undefined, x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', [], x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', {}, x, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', ( x: number ): number => x, x, 1, 0, sep, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not an array-like object... +{ + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( 4, '', '', 5, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( 4, '', '', true, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( 4, '', '', false, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( 4, '', '', null, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( 4, '', '', undefined, 1, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( 4, '', '', {}, 1, 0, sep, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, '', '', x, '5', 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, true, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, false, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, null, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, undefined, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, [], 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, {}, 0, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, ( x: number ): number => x, 0, sep, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, '', '', x, 1, '5', sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, true, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, false, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, null, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, undefined, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, [], sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, {}, sep, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, ( x: number ): number => x, sep, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not an array-like object... +{ + const x = [ 1, 2, 3, 4 ]; + + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, 5, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, true, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, false, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, null, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, undefined, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, {}, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, '5', 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, true, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, false, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, null, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, undefined, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, [], 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, {}, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, '5' ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, true ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, false ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, null ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, undefined ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, [] ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, {} ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided insufficient arguments... +{ + const x = [ 1, 2, 3, 4 ]; + const sep = [ ',', '-', '|' ]; + + gjoinBetween.ndarray(); // $ExpectError + gjoinBetween.ndarray( x.length ); // $ExpectError + gjoinBetween.ndarray( x.length, '' ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '' ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0 ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep ); // $ExpectError + gjoinBetween.ndarray( x.length, '', '', x, 1, 0, sep, 1 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/examples/index.js new file mode 100644 index 000000000000..36b17ff752d8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/examples/index.js @@ -0,0 +1,32 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var filled = require( '@stdlib/array/base/filled' ); +var gjoinBetween = require( './../lib' ); + +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( x ); + +var sep = filled( ' | ', x.length - 1 ); +var out = gjoinBetween( x.length, '[ ', ' ]', x, 1, sep, 1 ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js new file mode 100644 index 000000000000..6cd364833493 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isUndefinedOrNull = require( '@stdlib/assert/is-undefined-or-null' ); + + +// MAIN // + +/** +* Returns a string created by joining strided array elements using specified separators between consecutive elements. +* +* @private +* @param {PositiveInteger} N - number of indexed elements +* @param {string} prefix - string to prepend to the output string +* @param {string} suffix - string to append to the output string +* @param {Object} x - input array object +* @param {Collection} x.data - input array data +* @param {Array} x.accessors - array element accessors +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Object} separators - separators array object +* @param {Collection} separators.data - separators array data +* @param {Array} separators.accessors - array element accessors +* @param {integer} strideS - stride length for `separators` +* @param {NonNegativeInteger} offsetS - starting index for `separators` +* @returns {string} joined string +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var out = gjoinBetween( x.length, 'op: ', '', arraylike2object( toAccessorArray( x ) ), 1, 0, arraylike2object( toAccessorArray( sep ) ), 1, 0 ); +* // returns 'op: 1 + 2 - 3 != 4' +*/ +function gjoinBetween( N, prefix, suffix, x, strideX, offsetX, separators, strideS, offsetS ) { // eslint-disable-line max-len + var sbuf; + var xbuf; + var sget; + var xget; + var out; + var ix; + var is; + var v; + var i; + + // Cache references to array data: + xbuf = x.data; + sbuf = separators.data; + + // Cache references to element accessors: + xget = x.accessors[ 0 ]; + sget = separators.accessors[ 0 ]; + + out = prefix; + ix = offsetX; + is = offsetS; + for ( i = 0; i < N; i++ ) { + if ( i > 0 ) { + out += sget( sbuf, is ); + is += strideS; + } + v = xget( xbuf, ix ); + if ( !isUndefinedOrNull( v ) ) { + out += String( v ); + } + ix += strideX; + } + out += suffix; + return out; +} + + +// EXPORTS // + +module.exports = gjoinBetween; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js new file mode 100644 index 000000000000..10215a9b42fb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js @@ -0,0 +1,59 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Return a string created by joining strided array elements using specified separators between consecutive elements. +* +* @module @stdlib/blas/ext/base/gjoin-between +* +* @example +* var gjoinBetween = require( '@stdlib/blas/ext/base/gjoin-between' ); +* +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var str = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); +* // returns 'op: 1 + 2 - 3 != 4' +* +* @example +* var gjoinBetween = require( '@stdlib/blas/ext/base/gjoin-between' ); +* +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var str = gjoinBetween.ndarray( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); +* // returns 'op: 1 + 2 - 3 != 4' +*/ + +// 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 // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js new file mode 100644 index 000000000000..451bcb1ee60a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Returns a string created by joining strided array elements using specified separators between consecutive elements. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {string} prefix - string to prepend to the output string +* @param {string} suffix - string to append to the output string +* @param {Collection} x - input array +* @param {integer} strideX - stride length for `x` +* @param {Collection} separators - separators array +* @param {integer} strideS - stride length for `separators` +* @returns {string} joined string +* +* @example +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var out = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); +* // returns 'op: 1 + 2 - 3 != 4' +*/ +function gjoinBetween( N, prefix, suffix, x, strideX, separators, strideS ) { + var ox; + var os; + + ox = stride2offset( N, strideX ); + os = stride2offset( N - 1, strideS ); + return ndarray( N, prefix, suffix, x, strideX, ox, separators, strideS, os ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = gjoinBetween; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js new file mode 100644 index 000000000000..0be56e54bc8a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js @@ -0,0 +1,89 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isUndefinedOrNull = require( '@stdlib/assert/is-undefined-or-null' ); +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var accessors = require( './accessors.js' ); + + +// MAIN // + +/** +* Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {string} prefix - string to prepend to the output string +* @param {string} suffix - string to append to the output string +* @param {Collection} x - input array +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Collection} separators - separators array +* @param {integer} strideS - stride length for `separators` +* @param {NonNegativeInteger} offsetS - starting index for `separators` +* @returns {string} joined string +* +* @example +* var x = [ 1, 2, 3, 4 ]; +* var sep = [ ' + ', ' - ', ' != ' ]; +* +* var out = gjoinBetween( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); +* // returns 'op: 1 + 2 - 3 != 4' +*/ +function gjoinBetween( N, prefix, suffix, x, strideX, offsetX, separators, strideS, offsetS ) { // eslint-disable-line max-len + var out; + var ox; + var os; + var ix; + var is; + var v; + var i; + + if ( N <= 0 ) { + return prefix + suffix; + } + ox = arraylike2object( x ); + os = arraylike2object( separators ); + if ( ox.accessorProtocol || os.accessorProtocol ) { + return accessors( N, prefix, suffix, ox, strideX, offsetX, os, strideS, offsetS ); // eslint-disable-line max-len + } + out = prefix; + ix = offsetX; + is = offsetS; + for ( i = 0; i < N; i++ ) { + if ( i > 0 ) { + out += separators[ is ]; + is += strideS; + } + v = x[ ix ]; + if ( !isUndefinedOrNull( v ) ) { + out += String( v ); + } + ix += strideX; + } + out += suffix; + return out; +} + + +// EXPORTS // + +module.exports = gjoinBetween; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json new file mode 100644 index 000000000000..8d14c7563f6d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/blas/ext/base/gjoin-between", + "version": "0.0.0", + "description": "Return a string created by joining strided array elements using specified separators between consecutive elements.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "extended", + "join", + "string", + "strided", + "array", + "ndarray", + "separator" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.js new file mode 100644 index 000000000000..72a0fa647b80 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var gjoinBetween = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gjoinBetween, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof gjoinBetween.ndarray, 'function', 'method is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.main.js new file mode 100644 index 000000000000..502dcd817bcd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.main.js @@ -0,0 +1,156 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var gjoinBetween = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gjoinBetween, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( gjoinBetween.length, 7, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns the prefix and suffix joined together if provided an `N` parameter less than or equal to zero', function test( t ) { + var actual; + + actual = gjoinBetween( 0, 'a', 'b', [ 1, 2, 3 ], 1, [ ',', ',' ], 1 ); + t.strictEqual( actual, 'ab', 'returns expected value' ); + + actual = gjoinBetween( -1, 'a', 'b', [ 1, 2, 3 ], 1, [ ',', ',' ], 1 ); + t.strictEqual( actual, 'ab', 'returns expected value' ); + + actual = gjoinBetween( 0, '', '', [ 1, 2, 3 ], 1, [ ',', ',' ], 1 ); + t.strictEqual( actual, '', 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a string created by joining strided array elements using specified separators', function test( t ) { + var actual; + var sep; + var x; + + x = [ 1, 2, 3, 4 ]; + sep = [ ' + ', ' - ', ' != ' ]; + + // Basic usage with prefix... + actual = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); + t.strictEqual( actual, 'op: 1 + 2 - 3 != 4', 'returns expected value' ); + + // With suffix... + actual = gjoinBetween( x.length, '[', ']', x, 1, sep, 1 ); + t.strictEqual( actual, '[1 + 2 - 3 != 4]', 'returns expected value' ); + + // Without prefix or suffix... + actual = gjoinBetween( x.length, '', '', x, 1, sep, 1 ); + t.strictEqual( actual, '1 + 2 - 3 != 4', 'returns expected value' ); + + // Single element... + actual = gjoinBetween( 1, '<', '>', x, 1, sep, 1 ); + t.strictEqual( actual, '<1>', 'returns expected value' ); + + // Nonnegative stride for x and separators... + x = [ 1, 2, 3, 4, 5, 6 ]; + sep = [ ',', 'a', '-', 'b' ]; + actual = gjoinBetween( 3, '', '', x, 2, sep, 2 ); + t.strictEqual( actual, '1,3-5', 'returns expected value' ); + + // Negative stride for x... + x = [ 1, 2, 3, 4, 5, 6 ]; + sep = [ ',', '-', '|', '~', '=' ]; + actual = gjoinBetween( x.length, '', '', x, -1, sep, 1 ); + t.strictEqual( actual, '6,5-4|3~2=1', 'returns expected value' ); + + // Negative stride for separators... + x = [ 1, 2, 3, 4 ]; + sep = [ ' + ', ' - ', ' != ' ]; + actual = gjoinBetween( x.length, '', '', x, 1, sep, -1 ); + t.strictEqual( actual, '1 != 2 - 3 + 4', 'returns expected value' ); + + // Null and undefined values... + x = [ 1, null, 3, undefined, 5 ]; + sep = [ ',', ',', ',', ',' ]; + actual = gjoinBetween( x.length, '', '', x, 1, sep, 1 ); + t.strictEqual( actual, '1,,3,,5', 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a string created by joining strided array elements using specified separators (accessors)', function test( t ) { + var actual; + var sep; + var x; + + x = toAccessorArray( [ 1, 2, 3, 4 ] ); + sep = toAccessorArray( [ ' + ', ' - ', ' != ' ] ); + + // Basic usage with prefix... + actual = gjoinBetween( x.length, 'op: ', '', x, 1, sep, 1 ); + t.strictEqual( actual, 'op: 1 + 2 - 3 != 4', 'returns expected value' ); + + // With suffix... + actual = gjoinBetween( x.length, '[', ']', x, 1, sep, 1 ); + t.strictEqual( actual, '[1 + 2 - 3 != 4]', 'returns expected value' ); + + // Without prefix or suffix... + actual = gjoinBetween( x.length, '', '', x, 1, sep, 1 ); + t.strictEqual( actual, '1 + 2 - 3 != 4', 'returns expected value' ); + + // Single element... + actual = gjoinBetween( 1, '<', '>', x, 1, sep, 1 ); + t.strictEqual( actual, '<1>', 'returns expected value' ); + + // Nonnegative stride for x and separators... + x = toAccessorArray( [ 1, 2, 3, 4, 5, 6 ] ); + sep = toAccessorArray( [ ',', 'a', '-', 'b' ] ); + actual = gjoinBetween( 3, '', '', x, 2, sep, 2 ); + t.strictEqual( actual, '1,3-5', 'returns expected value' ); + + // Negative stride for x... + x = toAccessorArray( [ 1, 2, 3, 4, 5, 6 ] ); + sep = toAccessorArray( [ ',', '-', '|', '~', '=' ] ); + actual = gjoinBetween( x.length, '', '', x, -1, sep, 1 ); + t.strictEqual( actual, '6,5-4|3~2=1', 'returns expected value' ); + + // Negative stride for separators... + x = toAccessorArray( [ 1, 2, 3, 4 ] ); + sep = toAccessorArray( [ ' + ', ' - ', ' != ' ] ); + actual = gjoinBetween( x.length, '', '', x, 1, sep, -1 ); + t.strictEqual( actual, '1 != 2 - 3 + 4', 'returns expected value' ); + + // Null and undefined values... + x = toAccessorArray( [ 1, null, 3, undefined, 5 ] ); + sep = toAccessorArray( [ ',', ',', ',', ',' ] ); + actual = gjoinBetween( x.length, '', '', x, 1, sep, 1 ); + t.strictEqual( actual, '1,,3,,5', 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.ndarray.js new file mode 100644 index 000000000000..3d84f09d9d89 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/test/test.ndarray.js @@ -0,0 +1,168 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var gjoinBetween = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gjoinBetween, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 9', function test( t ) { + t.strictEqual( gjoinBetween.length, 9, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns the prefix and suffix joined together if provided an `N` parameter less than or equal to zero', function test( t ) { + var actual; + + actual = gjoinBetween( 0, 'a', 'b', [ 1, 2, 3 ], 1, 0, [ ',', ',' ], 1, 0 ); + t.strictEqual( actual, 'ab', 'returns expected value' ); + + actual = gjoinBetween( -1, 'a', 'b', [ 1, 2, 3 ], 1, 0, [ ',', ',' ], 1, 0 ); + t.strictEqual( actual, 'ab', 'returns expected value' ); + + actual = gjoinBetween( 0, '', '', [ 1, 2, 3 ], 1, 0, [ ',', ',' ], 1, 0 ); + t.strictEqual( actual, '', 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a string created by joining strided array elements using specified separators', function test( t ) { + var actual; + var sep; + var x; + + x = [ 1, 2, 3, 4 ]; + sep = [ ' + ', ' - ', ' != ' ]; + + // Basic usage... + actual = gjoinBetween( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, 'op: 1 + 2 - 3 != 4', 'returns expected value' ); + + // With suffix... + actual = gjoinBetween( x.length, '[', ']', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '[1 + 2 - 3 != 4]', 'returns expected value' ); + + // Without prefix or suffix... + actual = gjoinBetween( x.length, '', '', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '1 + 2 - 3 != 4', 'returns expected value' ); + + // Single element... + actual = gjoinBetween( 1, '<', '>', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '<1>', 'returns expected value' ); + + // With offset for x and separators... + x = [ 1, 2, 3, 4, 5, 6 ]; + sep = [ 'a', ',', '-' ]; + actual = gjoinBetween( 3, '', '', x, 1, 1, sep, 1, 1 ); + t.strictEqual( actual, '2,3-4', 'returns expected value' ); + + // Nonnegative stride for x and separators... + x = [ 1, 2, 3, 4, 5, 6 ]; + sep = [ ',', 'a', '-', 'b' ]; + actual = gjoinBetween( 3, '', '', x, 2, 0, sep, 2, 0 ); + t.strictEqual( actual, '1,3-5', 'returns expected value' ); + + // Negative stride for x... + x = [ 1, 2, 3, 4, 5, 6 ]; + sep = [ ',', '-', '|', '~', '=' ]; + actual = gjoinBetween( x.length, '', '', x, -1, x.length-1, sep, 1, 0 ); + t.strictEqual( actual, '6,5-4|3~2=1', 'returns expected value' ); + + // Negative stride for separators... + x = [ 1, 2, 3, 4 ]; + sep = [ ' + ', ' - ', ' != ' ]; + actual = gjoinBetween( x.length, '', '', x, 1, 0, sep, -1, sep.length-1 ); + t.strictEqual( actual, '1 != 2 - 3 + 4', 'returns expected value' ); + + // Null and undefined values... + x = [ 1, null, 3, undefined, 5 ]; + sep = [ ',', ',', ',', ',' ]; + actual = gjoinBetween( x.length, '', '', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '1,,3,,5', 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns a string created by joining strided array elements using specified separators (accessors)', function test( t ) { + var actual; + var sep; + var x; + + x = toAccessorArray( [ 1, 2, 3, 4 ] ); + sep = toAccessorArray( [ ' + ', ' - ', ' != ' ] ); + + // Basic usage... + actual = gjoinBetween( x.length, 'op: ', '', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, 'op: 1 + 2 - 3 != 4', 'returns expected value' ); + + // With suffix... + actual = gjoinBetween( x.length, '[', ']', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '[1 + 2 - 3 != 4]', 'returns expected value' ); + + // Without prefix or suffix... + actual = gjoinBetween( x.length, '', '', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '1 + 2 - 3 != 4', 'returns expected value' ); + + // Single element... + actual = gjoinBetween( 1, '<', '>', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '<1>', 'returns expected value' ); + + // With offset for x and separators... + x = toAccessorArray( [ 1, 2, 3, 4, 5, 6 ] ); + sep = toAccessorArray( [ 'a', ',', '-' ] ); + actual = gjoinBetween( 3, '', '', x, 1, 1, sep, 1, 1 ); + t.strictEqual( actual, '2,3-4', 'returns expected value' ); + + // Nonnegative stride for x and separators... + x = toAccessorArray( [ 1, 2, 3, 4, 5, 6 ] ); + sep = toAccessorArray( [ ',', 'a', '-', 'b' ] ); + actual = gjoinBetween( 3, '', '', x, 2, 0, sep, 2, 0 ); + t.strictEqual( actual, '1,3-5', 'returns expected value' ); + + // Negative stride for x... + x = toAccessorArray( [ 1, 2, 3, 4, 5, 6 ] ); + sep = toAccessorArray( [ ',', '-', '|', '~', '=' ] ); + actual = gjoinBetween( x.length, '', '', x, -1, x.length-1, sep, 1, 0 ); + t.strictEqual( actual, '6,5-4|3~2=1', 'returns expected value' ); + + // Negative stride for separators... + x = toAccessorArray( [ 1, 2, 3, 4 ] ); + sep = toAccessorArray( [ ' + ', ' - ', ' != ' ] ); + actual = gjoinBetween( x.length, '', '', x, 1, 0, sep, -1, sep.length-1 ); + t.strictEqual( actual, '1 != 2 - 3 + 4', 'returns expected value' ); + + // Null and undefined values... + x = toAccessorArray( [ 1, null, 3, undefined, 5 ] ); + sep = toAccessorArray( [ ',', ',', ',', ',' ] ); + actual = gjoinBetween( x.length, '', '', x, 1, 0, sep, 1, 0 ); + t.strictEqual( actual, '1,,3,,5', 'returns expected value' ); + + t.end(); +}); From 4e62b8768b1f30772a59d46287bdc7829b1f56c4 Mon Sep 17 00:00:00 2001 From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:55:04 +0500 Subject: [PATCH 02/10] docs: apply suggestion from code review Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com> --- lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md index 45d7a895ceb0..bdd2e7918c63 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md @@ -93,7 +93,7 @@ var str = gjoinBetween( 3, '[', ']', x1, 2, sep, 1 ); #### gjoinBetween.ndarray( N, prefix, suffix, x, strideX, offsetX, separators, strideS, offsetS ) - + Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. From f7ff536d875a7aea0424bf1282988166c1f4a165 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 25 Mar 2026 22:33:52 -0700 Subject: [PATCH 03/10] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js | 2 +- .../blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js index b6c67d145e95..b6e5e247fa68 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.js @@ -57,7 +57,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { out = gjoinBetween( x.length, '', '', x, 1, sep, 1 ); - if ( out !== out ) { + if ( !isString( out ) ) { b.fail( 'should return a string' ); } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js index 6fb737a740d7..70c8b7406c4a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/benchmark/benchmark.ndarray.js @@ -57,7 +57,7 @@ function createBenchmark( len ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { out = gjoinBetween( x.length, '', '', x, 1, 0, sep, 1, 0 ); - if ( out !== out ) { + if ( !isString( out ) ) { b.fail( 'should return a string' ); } } From 6e638e54f230fabbe0ed0c96190d7c1e35c7e8fa Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 25 Mar 2026 23:46:48 -0700 Subject: [PATCH 04/10] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gjoin-between/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md index bdd2e7918c63..bf054b1745f8 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md @@ -131,8 +131,8 @@ var str = gjoinBetween.ndarray( 3, '[ ', ' ]', x, 1, x.length-3, sep, 1, 0 ); ## Notes - If `N <= 0`, both functions return the prefix and suffix joined together. -- The `separators` array is assumed to have at least `N-1` elements (i.e., equal to the number of "gaps" between consecutive elements). -- If an array element is either `null` or `undefined`, both functions will serialize the element as an empty string. +- The `separators` array is assumed to have at least `N-1` indexed elements (i.e., equal to the number of "gaps" between consecutive elements). +- If an array element is either `null` or `undefined`, both functions serialize the element as an empty string. - 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]). From 4c1ad4ef615505c0a8b1c965760e107944614f42 Mon Sep 17 00:00:00 2001 From: Athan Date: Wed, 25 Mar 2026 23:47:10 -0700 Subject: [PATCH 05/10] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gjoin-between/docs/repl.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt index 506782f5a478..1e608d3f66eb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt @@ -11,8 +11,8 @@ If `N <= 0`, the function returns the prefix and suffix joined together. - If an array element is either `null` or `undefined`, the function will - serialize the element as an empty string. + If an array element is either `null` or `undefined`, the function serializes + the element as an empty string. Parameters ---------- From ad9042f55d48dd1b24020c6571adf6f916175a08 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Thu, 26 Mar 2026 21:54:05 +0500 Subject: [PATCH 06/10] fix: apply suggestions from code review --- .../blas/ext/base/gjoin-between/README.md | 8 ++++---- .../blas/ext/base/gjoin-between/docs/repl.txt | 18 +++++++++--------- .../base/gjoin-between/docs/types/index.d.ts | 6 +++--- .../ext/base/gjoin-between/lib/accessors.js | 2 +- .../blas/ext/base/gjoin-between/lib/index.js | 2 +- .../blas/ext/base/gjoin-between/lib/main.js | 2 +- .../blas/ext/base/gjoin-between/lib/ndarray.js | 2 +- .../blas/ext/base/gjoin-between/package.json | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md index bf054b1745f8..be3ba596525d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md @@ -20,7 +20,7 @@ limitations under the License. # gjoinBetween -> Return a string created by joining strided array elements using specified separators between consecutive elements. +> Return a string by joining strided array elements using a specified separator for each pair of consecutive elements. @@ -42,7 +42,7 @@ var gjoinBetween = require( '@stdlib/blas/ext/base/gjoin-between' ); #### gjoinBetween( N, prefix, suffix, x, strideX, separators, strideS ) -Returns a string created by joining strided array elements using specified separators between consecutive elements. +Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements. ```javascript var x = [ 1, 2, 3, 4 ]; @@ -95,7 +95,7 @@ var str = gjoinBetween( 3, '[', ']', x1, 2, sep, 1 ); -Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. +Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements and alternative indexing semantics. ```javascript var x = [ 1, 2, 3, 4 ]; @@ -132,7 +132,7 @@ var str = gjoinBetween.ndarray( 3, '[ ', ' ]', x, 1, x.length-3, sep, 1, 0 ); - If `N <= 0`, both functions return the prefix and suffix joined together. - The `separators` array is assumed to have at least `N-1` indexed elements (i.e., equal to the number of "gaps" between consecutive elements). -- If an array element is either `null` or `undefined`, both functions serialize the element as an empty string. +- If an array element is either `null` or `undefined`, both functions will serialize the element as an empty string. - 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]). diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt index 1e608d3f66eb..aa46fdaa652a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( N, prefix, suffix, x, strideX, separators, strideS ) - Returns a string created by joining strided array elements using specified - separators between consecutive elements. + Returns a string by joining strided array elements using a specified + separator for each pair of consecutive elements. The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. @@ -11,8 +11,8 @@ If `N <= 0`, the function returns the prefix and suffix joined together. - If an array element is either `null` or `undefined`, the function serializes - the element as an empty string. + If an array element is either `null` or `undefined`, the function will + serialize the element as an empty string. Parameters ---------- @@ -50,9 +50,9 @@ 'op: 1 + 2 - 3 != 4' -{{alias}}.ndarray( N, prefix, suffix, x, strideX, offsetX, separators, ss, os ) - Returns a string created by joining strided array elements using specified - separators between consecutive elements and alternative indexing +{{alias}}.ndarray( N, prefix, suffix, x, sx, ox, separators, ss, os ) + Returns a string by joining strided array elements using a specified + separator for each pair of consecutive elements and alternative indexing semantics. While typed array views mandate a view offset based on the underlying @@ -73,10 +73,10 @@ x: Array|TypedArray Input array. - strideX: integer + sx: integer Stride length for `x`. - offsetX: integer + ox: integer Starting index for `x`. separators: Array diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts index d956a2e20122..52e5a6aaf735 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/types/index.d.ts @@ -32,7 +32,7 @@ type InputArray = Collection | AccessorArrayLike; */ interface Routine { /** - * Returns a string created by joining strided array elements using specified separators between consecutive elements. + * Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements. * * @param N - number of indexed elements * @param prefix - string to prepend to the output string @@ -53,7 +53,7 @@ interface Routine { ( N: number, prefix: string, suffix: string, x: InputArray, strideX: number, separators: Collection, strideS: number ): string; /** - * Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. + * Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements and alternative indexing semantics. * * @param N - number of indexed elements * @param prefix - string to prepend to the output string @@ -77,7 +77,7 @@ interface Routine { } /** -* Returns a string created by joining strided array elements using specified separators between consecutive elements. +* Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements. * * @param N - number of indexed elements * @param prefix - string to prepend to the output string diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js index 6cd364833493..13bcf0bc43ba 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/accessors.js @@ -26,7 +26,7 @@ var isUndefinedOrNull = require( '@stdlib/assert/is-undefined-or-null' ); // MAIN // /** -* Returns a string created by joining strided array elements using specified separators between consecutive elements. +* Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements. * * @private * @param {PositiveInteger} N - number of indexed elements diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js index 10215a9b42fb..9856f63bc7ce 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Return a string created by joining strided array elements using specified separators between consecutive elements. +* Return a string by joining strided array elements using a specified separator for each pair of consecutive elements. * * @module @stdlib/blas/ext/base/gjoin-between * diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js index 451bcb1ee60a..d79117f975e7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/main.js @@ -27,7 +27,7 @@ var ndarray = require( './ndarray.js' ); // MAIN // /** -* Returns a string created by joining strided array elements using specified separators between consecutive elements. +* Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements. * * @param {PositiveInteger} N - number of indexed elements * @param {string} prefix - string to prepend to the output string diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js index 0be56e54bc8a..bfc0ae6379e9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/lib/ndarray.js @@ -28,7 +28,7 @@ var accessors = require( './accessors.js' ); // MAIN // /** -* Returns a string created by joining strided array elements using specified separators between consecutive elements and alternative indexing semantics. +* Returns a string by joining strided array elements using a specified separator for each pair of consecutive elements and alternative indexing semantics. * * @param {PositiveInteger} N - number of indexed elements * @param {string} prefix - string to prepend to the output string diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json index 8d14c7563f6d..db5b756b31bf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/ext/base/gjoin-between", "version": "0.0.0", - "description": "Return a string created by joining strided array elements using specified separators between consecutive elements.", + "description": "Return a string by joining strided array elements using a specified separator for each pair of consecutive elements.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From e75897cc72c19e4b852e850088d75c98dbf1b2cf Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 26 Mar 2026 18:59:23 -0700 Subject: [PATCH 07/10] Apply suggestion Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gjoin-between/docs/repl.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt index aa46fdaa652a..2649371fa4dc 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/docs/repl.txt @@ -11,8 +11,8 @@ If `N <= 0`, the function returns the prefix and suffix joined together. - If an array element is either `null` or `undefined`, the function will - serialize the element as an empty string. + If an array element is either `null` or `undefined`, the function serializes + the element as an empty string. Parameters ---------- From 56dccc61b10a3bfe9e64490fb3514fa33a5f9b69 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 26 Mar 2026 19:00:15 -0700 Subject: [PATCH 08/10] Apply suggestion Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md index be3ba596525d..e6e9b1c786b7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md @@ -132,7 +132,7 @@ var str = gjoinBetween.ndarray( 3, '[ ', ' ]', x, 1, x.length-3, sep, 1, 0 ); - If `N <= 0`, both functions return the prefix and suffix joined together. - The `separators` array is assumed to have at least `N-1` indexed elements (i.e., equal to the number of "gaps" between consecutive elements). -- If an array element is either `null` or `undefined`, both functions will serialize the element as an empty string. +- If an array element is either `null` or `undefined`, both functions serialize the element as an empty string. - 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]). From aea0aefb8cd8edcbdfd2651ae8c91cbe113b7e98 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 26 Mar 2026 19:04:13 -0700 Subject: [PATCH 09/10] Apply suggestion Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gjoin-between/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json index db5b756b31bf..1249ba9d7bc9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/package.json @@ -50,9 +50,6 @@ ], "keywords": [ "stdlib", - "stdmath", - "mathematics", - "math", "blas", "extended", "join", From d4de8a81428d4563d53557c4999ca12fd18a2226 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 26 Mar 2026 19:05:30 -0700 Subject: [PATCH 10/10] Apply suggestion Signed-off-by: Athan --- lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md index e6e9b1c786b7..522cb1037870 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gjoin-between/README.md @@ -110,7 +110,7 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetS**: starting index for `separators`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to access only the last three elements of the strided array: +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to access only the last three elements of the input strided array: ```javascript var x = [ 1, 2, 3, 4, 5, 6 ];