@@ -69,9 +69,9 @@ var arr = ndarray2array( y );
6969The function accepts the following arguments:
7070
7171- ** x** : input [ ndarray] [ @stdlib/ndarray/ctor ] .
72- - ** options** : function options.
72+ - ** options** : function options _ (optional) _ .
7373- ** predicate** : predicate function.
74- - ** thisArg** : predicate function execution context.
74+ - ** thisArg** : predicate function execution context _ (optional) _ .
7575
7676The function accepts the following options:
7777
@@ -113,6 +113,41 @@ var arr = ndarray2array( y );
113113// returns [ 8.0, 9.0, 10.0 ]
114114```
115115
116+ To set the ` predicate ` function execution context, provide a ` thisArg ` .
117+
118+ <!-- eslint-disable no-invalid-this, max-len -->
119+
120+ ``` javascript
121+ var Float64Array = require ( ' @stdlib/array/float64' );
122+ var ndarray = require ( ' @stdlib/ndarray/ctor' );
123+ var ndarray2array = require ( ' @stdlib/ndarray/to-array' );
124+
125+ function predicate ( z ) {
126+ this .count += 1 ;
127+ return z <= 6.0 ;
128+ }
129+
130+ var buffer = new Float64Array ( [ 1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 , 7.0 , 8.0 , 9.0 , 10.0 , 11.0 , 12.0 ] );
131+ var shape = [ 2 , 3 ];
132+ var strides = [ 6 , 1 ];
133+ var offset = 1 ;
134+
135+ var x = ndarray ( ' float64' , buffer, shape, strides, offset, ' row-major' );
136+ // returns <ndarray>
137+
138+ var ctx = {
139+ ' count' : 0
140+ };
141+ var y = reject ( x, predicate, ctx );
142+ // returns <ndarray>
143+
144+ var arr = ndarray2array ( y );
145+ // returns [ 8.0, 9.0, 10.0 ]
146+
147+ var count = ctx .count ;
148+ // returns 6
149+ ```
150+
116151The ` predicate ` function is provided the following arguments:
117152
118153- ** value** : current array element.
0 commit comments