Skip to content

Commit 8744ffa

Browse files
committed
Refactor to use zero-based indexing
1 parent a4963c3 commit 8744ffa

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

lib/node_modules/@stdlib/iter/to-array-view/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ The invoked function is provided three arguments:
122122

123123
- `value`: iterated value
124124
- `index`: destination index
125-
- `n`: iteration count (one-based)
125+
- `n`: iteration count (zero-based)
126126

127127
```javascript
128128
var Uint8Array = require( '@stdlib/array/uint8' );

lib/node_modules/@stdlib/iter/to-array-view/docs/repl.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- value: iterated value
88
- index: destination index (zero-based)
9-
- n: iteration count (one-based)
9+
- n: iteration index (zero-based)
1010

1111
Iteration stops when an output array view is full or an iterator finishes;
1212
whichever comes first.

lib/node_modules/@stdlib/iter/to-array-view/lib/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function iterator2arrayview( iterator, out ) {
145145
i += 1;
146146
v = iterator.next();
147147
if ( hasOwnProp( v, 'value' ) ) {
148-
out[ i ] = fcn.call( thisArg, v.value, i, i-begin+1 );
148+
out[ i ] = fcn.call( thisArg, v.value, i, i-begin );
149149
}
150150
if ( v.done ) {
151151
break;

lib/node_modules/@stdlib/iter/to-array-view/test/test.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
981981
t.end();
982982

983983
function scale( v, i, n ) {
984-
return v * n;
984+
return v * (n+1);
985985
}
986986
});
987987

@@ -1004,7 +1004,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
10041004
t.end();
10051005

10061006
function scale( v, i, n ) {
1007-
return v * n;
1007+
return v * (n+1);
10081008
}
10091009
});
10101010

@@ -1027,7 +1027,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
10271027
t.end();
10281028

10291029
function scale( v, i, n ) {
1030-
return v * n;
1030+
return v * (n+1);
10311031
}
10321032
});
10331033

@@ -1050,7 +1050,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
10501050
t.end();
10511051

10521052
function scale( v, i, n ) {
1053-
return v * n;
1053+
return v * (n+1);
10541054
}
10551055
});
10561056

@@ -1073,7 +1073,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
10731073
t.end();
10741074

10751075
function scale( v, i, n ) {
1076-
return v * n;
1076+
return v * (n+1);
10771077
}
10781078
});
10791079

@@ -1096,7 +1096,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
10961096
t.end();
10971097

10981098
function scale( v, i, n ) {
1099-
return v * n;
1099+
return v * (n+1);
11001100
}
11011101
});
11021102

@@ -1119,7 +1119,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
11191119
t.end();
11201120

11211121
function scale( v, i, n ) {
1122-
return v * n;
1122+
return v * (n+1);
11231123
}
11241124
});
11251125

@@ -1165,7 +1165,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
11651165
t.end();
11661166

11671167
function scale( v, i, n ) {
1168-
return v * n;
1168+
return v * (n+1);
11691169
}
11701170
});
11711171

@@ -1188,7 +1188,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
11881188
t.end();
11891189

11901190
function scale( v, i, n ) {
1191-
return v * n;
1191+
return v * (n+1);
11921192
}
11931193
});
11941194

@@ -1211,7 +1211,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
12111211
t.end();
12121212

12131213
function scale( v, i, n ) {
1214-
return v * n;
1214+
return v * (n+1);
12151215
}
12161216
});
12171217

@@ -1234,7 +1234,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
12341234
t.end();
12351235

12361236
function scale( v, i, n ) {
1237-
return v * n;
1237+
return v * (n+1);
12381238
}
12391239
});
12401240

@@ -1257,7 +1257,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
12571257
t.end();
12581258

12591259
function scale( v, i, n ) {
1260-
return v * n;
1260+
return v * (n+1);
12611261
}
12621262
});
12631263

@@ -1280,7 +1280,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
12801280
t.end();
12811281

12821282
function scale( v, i, n ) {
1283-
return v * n;
1283+
return v * (n+1);
12841284
}
12851285
});
12861286

@@ -1303,7 +1303,7 @@ tape( 'the function supports providing a callback to be invoked for each iterate
13031303
t.end();
13041304

13051305
function scale( v, i, n ) {
1306-
return v * n;
1306+
return v * (n+1);
13071307
}
13081308
});
13091309

@@ -1443,7 +1443,7 @@ tape( 'the function supports specifying the evaluation context of a provided cal
14431443

14441444
function scale( v, i, n ) {
14451445
this.count += 1; // eslint-disable-line no-invalid-this
1446-
return v * n;
1446+
return v * (n+1);
14471447
}
14481448
});
14491449

@@ -1471,7 +1471,7 @@ tape( 'the function supports specifying the evaluation context of a provided cal
14711471

14721472
function scale( v, i, n ) {
14731473
this.count += 1; // eslint-disable-line no-invalid-this
1474-
return v * n;
1474+
return v * (n+1);
14751475
}
14761476
});
14771477

0 commit comments

Comments
 (0)