Skip to content

Commit 8df4bfb

Browse files
committed
chore: clean-up
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent b0ef28a commit 8df4bfb

File tree

14 files changed

+220
-180
lines changed

14 files changed

+220
-180
lines changed

lib/node_modules/@stdlib/array/base/to-inserted-at/README.md

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

2121
# toInsertedAt
2222

23-
> Return a new array containing every element from an input array, with a provided value inserted at a specified index.
23+
> Return a new array containing every element from an input array and with a provided value inserted at a specified index.
2424
2525
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
2626

@@ -42,7 +42,7 @@ var toInsertedAt = require( '@stdlib/array/base/to-inserted-at' );
4242

4343
#### toInsertedAt( x, index, value )
4444

45-
Returns a new array containing every element from an input array, with a provided value inserted at a specified index.
45+
Returns a new array containing every element from an input array and with a provided value inserted at a specified index.
4646

4747
```javascript
4848
var x = [ 1, 2, 3, 4 ];
@@ -62,7 +62,7 @@ The function accepts the following arguments:
6262

6363
### toInsertedAt.assign( x, index, value, out, stride, offset )
6464

65-
Copies elements from one array to another array and sets the element at the specified index to a provided value.
65+
Copies elements from one array to another array and inserts a provided value at a specified index.
6666

6767
```javascript
6868
var x = [ 1, 2, 3, 4 ];
@@ -119,12 +119,12 @@ var opts = {
119119
var x = discreteUniform( 5, -100, 100, opts );
120120

121121
// Define an array containing random index values:
122-
var indices = discreteUniform( 100, -x.length, x.length-1, opts );
122+
var indices = discreteUniform( 100, -x.length, x.length, opts );
123123

124-
// Define an array with random values to set:
124+
// Define an array with random values to insert:
125125
var values = discreteUniform( indices.length, -10000, 10000, opts );
126126

127-
// Randomly set elements in the input array:
127+
// Randomly insert elements in the input array:
128128
var i;
129129
for ( i = 0; i < indices.length; i++ ) {
130130
console.log( 'x = [%s]', toInsertedAt( x, indices[ i ], values[ i ] ).join( ',' ) );

lib/node_modules/@stdlib/array/base/to-inserted-at/benchmark/benchmark.assign.length.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ var toInsertedAt = require( './../lib' );
3939
* @returns {Function} benchmark function
4040
*/
4141
function createBenchmark( len ) {
42+
var out = zeros( len+1 );
43+
var x = ones( len );
4244
return benchmark;
4345

4446
/**
@@ -48,15 +50,11 @@ function createBenchmark( len ) {
4850
* @param {Benchmark} b - benchmark instance
4951
*/
5052
function benchmark( b ) {
51-
var out;
5253
var v;
53-
var x;
5454
var i;
5555

5656
b.tic();
5757
for ( i = 0; i < b.iterations; i++ ) {
58-
x = ones( len );
59-
out = zeros( len );
6058
v = toInsertedAt.assign( x, i%len, i, out, 1, 0 );
6159
if ( typeof v !== 'object' ) {
6260
b.fail( 'should return an array' );

lib/node_modules/@stdlib/array/base/to-inserted-at/benchmark/benchmark.length.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var toInsertedAt = require( './../lib' );
3838
* @returns {Function} benchmark function
3939
*/
4040
function createBenchmark( len ) {
41+
var x = ones( len );
4142
return benchmark;
4243

4344
/**
@@ -48,14 +49,12 @@ function createBenchmark( len ) {
4849
*/
4950
function benchmark( b ) {
5051
var out;
51-
var x;
5252
var i;
5353

5454
b.tic();
5555
for ( i = 0; i < b.iterations; i++ ) {
56-
x = ones( len );
5756
out = toInsertedAt( x, i%len, i );
58-
if ( out.length !== len + 1 ) {
57+
if ( out.length !== len+1 ) {
5958
b.fail( 'unexpected length' );
6059
}
6160
}

lib/node_modules/@stdlib/array/base/to-inserted-at/docs/repl.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
{{alias}}( x, index, value )
3-
Returns a new array containing every element from an input array, with a
3+
Returns a new array containing every element from an input array and with a
44
provided value inserted at a specified index.
55

66
Negative indices are resolved relative to the last array element, with the
@@ -12,7 +12,7 @@
1212
Input array.
1313

1414
index: integer
15-
Index of the element to be inserted.
15+
Index at which to insert a value.
1616

1717
value: any
1818
Value to insert.
@@ -34,8 +34,8 @@
3434

3535

3636
{{alias}}.assign( x, index, value, out, stride, offset )
37-
Copies elements from one array to another array and with a provided value
38-
inserted at a specified index.
37+
Copies elements from one array to another array and inserts a provided value
38+
at a specified index.
3939

4040
Negative indices are resolved relative to the last array element, with the
4141
last element corresponding to `-1`.
@@ -46,7 +46,7 @@
4646
Input array.
4747

4848
index: integer
49-
Index of the element to be inserted.
49+
Index at which to insert a value.
5050

5151
value: any
5252
Value to insert.

lib/node_modules/@stdlib/array/base/to-inserted-at/docs/types/index.d.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ import { ComplexLike } from '@stdlib/types/complex';
2626
/**
2727
* Interface describing `toInsertedAt`.
2828
*/
29-
interface Array2InsertedAt {
29+
interface ToInsertedAt {
3030
/**
31-
* Returns a new array containing every element from an input array, with a provided value inserted at a specified index.
31+
* Returns a new array containing every element from an input array and with a provided value inserted at a specified index.
3232
*
3333
* @param x - input array
34-
* @param index - index at which to set a provided value
34+
* @param index - index at which to insert a provided value
3535
* @param value - value to insert
3636
* @returns output array
3737
*
@@ -47,10 +47,10 @@ interface Array2InsertedAt {
4747
<T extends ComplexTypedArray>( x: T, index: number, value: ComplexLike ): T;
4848

4949
/**
50-
* Returns a new array containing every element from an input array, with a provided value inserted at a specified index.
50+
* Returns a new array containing every element from an input array and with a provided value inserted at a specified index.
5151
*
5252
* @param x - input array
53-
* @param index - index at which to set a provided value
53+
* @param index - index at which to insert a provided value
5454
* @param value - value to insert
5555
* @returns output array
5656
*
@@ -65,10 +65,10 @@ interface Array2InsertedAt {
6565
<T extends RealTypedArray>( x: T, index: number, value: number ): T; // eslint-disable-line @typescript-eslint/unified-signatures
6666

6767
/**
68-
* Returns a new array containing every element from an input array, with a provided value inserted at a specified index.
68+
* Returns a new array containing every element from an input array and with a provided value inserted at a specified index.
6969
*
7070
* @param x - input array
71-
* @param index - index at which to set a provided value
71+
* @param index - index at which to insert a provided value
7272
* @param value - value to insert
7373
* @returns output array
7474
*
@@ -87,10 +87,10 @@ interface Array2InsertedAt {
8787
<T = unknown>( x: Collection<T>, index: number, value: T ): Array<T>;
8888

8989
/**
90-
* Copies elements from one array to another array and inserts the element at the specified index to a provided value.
90+
* Copies elements from one array to another array and inserts a provided value at a specified index.
9191
*
9292
* @param x - input array
93-
* @param index - index at which to set a provided value
93+
* @param index - index at which to insert a provided value
9494
* @param value - value to insert
9595
* @param out - output array
9696
* @param stride - output array stride
@@ -112,10 +112,10 @@ interface Array2InsertedAt {
112112
assign<T extends RealTypedArray>( x: Collection | AccessorArrayLike<any>, index: number, value: number, out: T, stride: number, offset: number ): T;
113113

114114
/**
115-
* Copies elements from one array to another array and inserts the element at the specified index to a provided value.
115+
* Copies elements from one array to another array and inserts a provided value at a specified index.
116116
*
117117
* @param x - input array
118-
* @param index - index at which to set a provided value
118+
* @param index - index at which to insert a provided value
119119
* @param value - value to insert
120120
* @param out - output array
121121
* @param stride - output array stride
@@ -138,10 +138,10 @@ interface Array2InsertedAt {
138138
assign<T extends ComplexTypedArray>( x: Collection | AccessorArrayLike<any>, index: number, value: ComplexLike, out: T, stride: number, offset: number ): T; // eslint-disable-line @typescript-eslint/unified-signatures
139139

140140
/**
141-
* Copies elements from one array to another array and inserts the element at the specified index to a provided value.
141+
* Copies elements from one array to another array and inserts a provided value at a specified index.
142142
*
143143
* @param x - input array
144-
* @param index - index at which to set a provided value
144+
* @param index - index at which to insert a provided value
145145
* @param value - value to insert
146146
* @param out - output array
147147
* @param stride - output array stride
@@ -161,10 +161,10 @@ interface Array2InsertedAt {
161161
assign<T = unknown, U = unknown, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, index: number, value: U, out: Array<V>, stride: number, offset: number ): Array<T | U | V>;
162162

163163
/**
164-
* Copies elements from one array to another array and inserts the element at the specified index to a provided value.
164+
* Copies elements from one array to another array and inserts a provided value at a specified index.
165165
*
166166
* @param x - input array
167-
* @param index - index at which to set a provided value
167+
* @param index - index at which to insert a provided value
168168
* @param value - value to insert
169169
* @param out - output array
170170
* @param stride - output array stride
@@ -179,7 +179,7 @@ interface Array2InsertedAt {
179179
* var out = toAccessorArray( [ 0, 0, 0, 0, 0 ] );
180180
* var arr = toInsertedAt.assign( x, 0, 5, out, 1, 0 );
181181
*
182-
* var v = out[ 0 ];
182+
* var v = out.get( 0 );
183183
* // returns 5
184184
*
185185
* var bool = ( arr === out );
@@ -188,10 +188,10 @@ interface Array2InsertedAt {
188188
assign<T = unknown, U = unknown, V = unknown>( x: Collection<T> | AccessorArrayLike<T>, index: number, value: U, out: AccessorArrayLike<V>, stride: number, offset: number ): AccessorArrayLike<T | U | V>;
189189

190190
/**
191-
* Copies elements from one array to another array and inserts the element at the specified index to a provided value.
191+
* Copies elements from one array to another array and inserts a provided value at a specified index.
192192
*
193193
* @param x - input array
194-
* @param index - index at which to set a provided value
194+
* @param index - index at which to insert a provided value
195195
* @param value - value to insert
196196
* @param out - output array
197197
* @param stride - output array stride
@@ -212,10 +212,10 @@ interface Array2InsertedAt {
212212
}
213213

214214
/**
215-
* Returns a new array containing every element from an input array, with a provided value inserted at a specified index.
215+
* Returns a new array containing every element from an input array and with a provided value inserted at a specified index.
216216
*
217217
* @param x - input array
218-
* @param index - index at which to set a provided value
218+
* @param index - index at which to insert a provided value
219219
* @param value - value to insert
220220
* @returns output array
221221
*
@@ -243,7 +243,7 @@ interface Array2InsertedAt {
243243
* var bool = ( arr === out );
244244
* // returns true
245245
*/
246-
declare var toInsertedAt: Array2InsertedAt;
246+
declare var toInsertedAt: ToInsertedAt;
247247

248248

249249
// EXPORTS //

lib/node_modules/@stdlib/array/base/to-inserted-at/docs/types/test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import toInsertedAt = require( './index' );
2424

2525
// TESTS //
2626

27-
// The function returns an updated array...
27+
// The function returns an array...
2828
{
2929
toInsertedAt( [ 1, 2, 3, 4 ], 0, 5 ); // $ExpectType number[]
3030
toInsertedAt( new Complex128Array( 5 ), 0, { 're': 1.0, 'im': 1.0 } ); // $ExpectType Complex128Array
@@ -72,23 +72,23 @@ import toInsertedAt = require( './index' );
7272
const x = [ 1, 2, 3, 4 ];
7373
const y = new Complex128Array( 4 );
7474

75-
toInsertedAt.assign( x, 0, 5, [ 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[]
76-
toInsertedAt.assign( x, 0, 5, new Float64Array( 4 ), 1, 0 ); // $ExpectType Float64Array
77-
toInsertedAt.assign( x, 0, 5, new Float32Array( 4 ), 1, 0 ); // $ExpectType Float32Array
78-
toInsertedAt.assign( x, 0, 5, new Int32Array( 4 ), 1, 0 ); // $ExpectType Int32Array
79-
toInsertedAt.assign( x, 0, 5, new Int16Array( 4 ), 1, 0 ); // $ExpectType Int16Array
80-
toInsertedAt.assign( x, 0, 5, new Int8Array( 4 ), 1, 0 ); // $ExpectType Int8Array
81-
toInsertedAt.assign( x, 0, 5, new Uint32Array( 4 ), 1, 0 ); // $ExpectType Uint32Array
82-
toInsertedAt.assign( x, 0, 5, new Uint16Array( 4 ), 1, 0 ); // $ExpectType Uint16Array
83-
toInsertedAt.assign( x, 0, 5, new Uint8Array( 4 ), 1, 0 ); // $ExpectType Uint8Array
84-
toInsertedAt.assign( x, 0, 5, new Uint8ClampedArray( 4 ), 1, 0 ); // $ExpectType Uint8ClampedArray
85-
toInsertedAt.assign( y, 0, { 're': 1.0, 'im': 1.0 }, new Complex128Array( 4 ), 1, 0 ); // $ExpectType Complex128Array
86-
toInsertedAt.assign( y, 0, { 're': 1.0, 'im': 1.0 }, new Complex64Array( 4 ), 1, 0 ); // $ExpectType Complex64Array
75+
toInsertedAt.assign( x, 0, 5, [ 0, 0, 0, 0, 0 ], 1, 0 ); // $ExpectType number[]
76+
toInsertedAt.assign( x, 0, 5, new Float64Array( 5 ), 1, 0 ); // $ExpectType Float64Array
77+
toInsertedAt.assign( x, 0, 5, new Float32Array( 5 ), 1, 0 ); // $ExpectType Float32Array
78+
toInsertedAt.assign( x, 0, 5, new Int32Array( 5 ), 1, 0 ); // $ExpectType Int32Array
79+
toInsertedAt.assign( x, 0, 5, new Int16Array( 5 ), 1, 0 ); // $ExpectType Int16Array
80+
toInsertedAt.assign( x, 0, 5, new Int8Array( 5 ), 1, 0 ); // $ExpectType Int8Array
81+
toInsertedAt.assign( x, 0, 5, new Uint32Array( 5 ), 1, 0 ); // $ExpectType Uint32Array
82+
toInsertedAt.assign( x, 0, 5, new Uint16Array( 5 ), 1, 0 ); // $ExpectType Uint16Array
83+
toInsertedAt.assign( x, 0, 5, new Uint8Array( 5 ), 1, 0 ); // $ExpectType Uint8Array
84+
toInsertedAt.assign( x, 0, 5, new Uint8ClampedArray( 5 ), 1, 0 ); // $ExpectType Uint8ClampedArray
85+
toInsertedAt.assign( y, 0, { 're': 1.0, 'im': 1.0 }, new Complex128Array( 5 ), 1, 0 ); // $ExpectType Complex128Array
86+
toInsertedAt.assign( y, 0, { 're': 1.0, 'im': 1.0 }, new Complex64Array( 5 ), 1, 0 ); // $ExpectType Complex64Array
8787
}
8888

8989
// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object...
9090
{
91-
const out = [ 0, 0, 0, 0 ];
91+
const out = [ 0, 0, 0, 0, 0 ];
9292

9393
toInsertedAt.assign( 1, 0, 5, out, 1, 0 ); // $ExpectError
9494
toInsertedAt.assign( true, 0, 5, out, 1, 0 ); // $ExpectError
@@ -101,7 +101,7 @@ import toInsertedAt = require( './index' );
101101
// The compiler throws an error if the `assign` method is provided a second argument which is not a number...
102102
{
103103
const x = [ 1, 2, 3, 4 ];
104-
const out = [ 0, 0, 0, 0 ];
104+
const out = [ 0, 0, 0, 0, 0 ];
105105

106106
toInsertedAt.assign( x, '1', 5, out, 1, 0 ); // $ExpectError
107107
toInsertedAt.assign( x, true, 5, out, 1, 0 ); // $ExpectError
@@ -129,7 +129,7 @@ import toInsertedAt = require( './index' );
129129
// The compiler throws an error if the `assign` method is provided a fifth argument which is not a number...
130130
{
131131
const x = [ 1, 2, 3, 4 ];
132-
const out = [ 0, 0, 0, 0 ];
132+
const out = [ 0, 0, 0, 0, 0 ];
133133

134134
toInsertedAt.assign( x, 0, 1, out, '1', 0 ); // $ExpectError
135135
toInsertedAt.assign( x, 0, 1, out, true, 0 ); // $ExpectError
@@ -144,7 +144,7 @@ import toInsertedAt = require( './index' );
144144
// The compiler throws an error if the `assign` method is provided a sixth argument which is not a number...
145145
{
146146
const x = [ 1, 2, 3, 4 ];
147-
const out = [ 0, 0, 0, 0 ];
147+
const out = [ 0, 0, 0, 0, 0 ];
148148

149149
toInsertedAt.assign( x, 0, 1, out, 1, '1' ); // $ExpectError
150150
toInsertedAt.assign( x, 0, 1, out, 1, true ); // $ExpectError
@@ -159,7 +159,7 @@ import toInsertedAt = require( './index' );
159159
// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
160160
{
161161
const x = [ 1, 2, 3, 4 ];
162-
const out = [ 0, 0, 0, 0 ];
162+
const out = [ 0, 0, 0, 0, 0 ];
163163

164164
toInsertedAt.assign(); // $ExpectError
165165
toInsertedAt.assign( x ); // $ExpectError

lib/node_modules/@stdlib/array/base/to-inserted-at/examples/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ var opts = {
2828
var x = discreteUniform( 5, -100, 100, opts );
2929

3030
// Define an array containing random index values:
31-
var indices = discreteUniform( 100, -x.length, x.length-1, opts );
31+
var indices = discreteUniform( 100, -x.length, x.length, opts );
3232

33-
// Define an array with random values to set:
33+
// Define an array with random values to insert:
3434
var values = discreteUniform( indices.length, -10000, 10000, opts );
3535

36-
// Randomly set elements in the input array:
36+
// Randomly insert elements in the input array:
3737
var i;
3838
for ( i = 0; i < indices.length; i++ ) {
3939
console.log( 'x = [%s]', toInsertedAt( x, indices[ i ], values[ i ] ).join( ',' ) );

0 commit comments

Comments
 (0)