Skip to content
Permalink
Browse files

Document method

  • Loading branch information...
kgryte committed Sep 19, 2018
1 parent 4a07206 commit c24e7d3900dae4eb64b965d047aaabe141463a56
@@ -1635,7 +1635,6 @@ limitations under the License.

1. [ilogb](https://github.com/JuliaLang/openlibm/blob/master/src/s_ilogb.c) and [logb](https://github.com/JuliaLang/openlibm/blob/master/src/s_logb.c), although these may just be `float64-exponent`


1. stream module (e.g., flow-split, flow-join, flow-mean) => /utils /math etc

1. [hdbscan](https://github.com/lmcinnes/hdbscan)
@@ -1676,8 +1675,6 @@ limitations under the License.

1. [to-number](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.curry/index.js#L1160)

1. global var detection

1. feature detection [utils](https://github.com/williamkapke/node-compat-table/blob/gh-pages/testers.json)

1. port `https-server`
@@ -1105,6 +1105,60 @@ var n = ctx.count;
// returns 3
```

<a name="method-for-each"></a>

#### tuple.forEach( fcn\[, thisArg] )

Invokes a callback for each tuple element.

```javascript
var factory = namedtypedtuple( [ 'x', 'y', 'z' ] );
var tuple = factory( [ 1.0, 0.0, -1.0 ], 'int32' );
var str = '';
function fcn( v, i, f ) {
str += f + '=' + v;
if ( i < tuple.length-1 ) {
str += ' ';
}
}
tuple.forEach( fcn );
console.log( str );
// => 'x=1 y=0 z=-1'
```

The callback is provided four arguments:

- `value`: tuple element
- `index`: tuple index
- `field`: tuple field name
- `tuple`: tuple on which the method is invoked

To set the callback execution context, provide a `thisArg`.

```javascript
var factory = namedtypedtuple( [ 'x', 'y', 'z' ] );
var tuple = factory( [ 1.0, 0.0, -1.0 ], 'int32' );
function fcn() {
this.count += 1;
}
var ctx = {
'count': 0
};
tuple.forEach( fcn, ctx );
var n = ctx.count;
// returns 3
```

</section>

<!-- /.usage -->
@@ -691,11 +691,11 @@ tuple.forEach( fcn[, thisArg] )
--------
> var factory = {{alias}}( [ 'x', 'y', 'z' ] );
> var p = factory( [ 1, 0, -1 ], 'int32' );
> var str = '';
> var str = ' ';
> function fcn( v, i, f ) { str += f + '=' + v + ' '; };
> p.forEach( fcn );
> str
'x=1 y=0 z=-1'
' x=1 y=0 z=-1 '


tuple.includes( searchElement[, fromIndex] )

0 comments on commit c24e7d3

Please sign in to comment.
You can’t perform that action at this time.