Skip to content

Commit 78c20d6

Browse files
authored
docs: update README example in iter/for-each
PR-URL: stdlib-js#1181 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent e31987a commit 78c20d6

File tree

1 file changed

+8
-8
lines changed
  • lib/node_modules/@stdlib/iter/for-each

1 file changed

+8
-8
lines changed

lib/node_modules/@stdlib/iter/for-each/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License.
1818
1919
-->
2020

21-
# forEach Iterator
21+
# iterForEach
2222

2323
> Create an iterator which invokes a function for each iterated value before returning the iterated value.
2424
@@ -73,17 +73,17 @@ The returned iterator protocol-compliant object has the following properties:
7373
- **next**: function which returns an iterator protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the iterator is finished.
7474
- **return**: function which closes an iterator and returns a single (optional) argument in an iterator protocol-compliant object.
7575

76-
The invoked `function` is provided two arguments:
76+
The invoked function is provided two arguments:
7777

78-
- `value`: iterated value
79-
- `index`: iteration index (zero-based)
78+
- **value**: iterated value
79+
- **index**: iteration index (zero-based)
8080

8181
```javascript
8282
var array2iterator = require( '@stdlib/array/to-iterator' );
8383

84-
function assert( v ) {
85-
if ( v !== v ) {
86-
throw new Error( 'should not be NaN' );
84+
function assert( v, i ) {
85+
if ( i < 0 ) {
86+
throw new Error( 'unexpected Error' );
8787
}
8888
}
8989

@@ -102,7 +102,7 @@ r = it.next().value;
102102
// ...
103103
```
104104

105-
To set the function execution context, provide a `thisArg`.
105+
To set the execution context for `fcn`, provide a `thisArg`.
106106

107107
```javascript
108108
var array2iterator = require( '@stdlib/array/to-iterator' );

0 commit comments

Comments
 (0)