@stdlib/stats-iter-curange 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +42 -2
- package/lib/main.js +9 -11
- package/package.json +1 -2
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2022 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ limitations under the License.
|
|
|
20
20
|
|
|
21
21
|
# itercurange
|
|
22
22
|
|
|
23
|
-
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
|
|
23
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
24
24
|
|
|
25
25
|
> Create an [iterator][mdn-iterator-protocol] which iteratively computes a cumulative range.
|
|
26
26
|
|
|
@@ -140,6 +140,23 @@ while ( true ) {
|
|
|
140
140
|
|
|
141
141
|
<!-- /.references -->
|
|
142
142
|
|
|
143
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
144
|
+
|
|
145
|
+
<section class="related">
|
|
146
|
+
|
|
147
|
+
* * *
|
|
148
|
+
|
|
149
|
+
## See Also
|
|
150
|
+
|
|
151
|
+
- <span class="package-name">[`@stdlib/stats/iter/cumax`][@stdlib/stats/iter/cumax]</span><span class="delimiter">: </span><span class="description">create an iterator which iteratively computes a cumulative maximum value.</span>
|
|
152
|
+
- <span class="package-name">[`@stdlib/stats/iter/cumean`][@stdlib/stats/iter/cumean]</span><span class="delimiter">: </span><span class="description">create an iterator which iteratively computes a cumulative arithmetic mean.</span>
|
|
153
|
+
- <span class="package-name">[`@stdlib/stats/iter/cumin`][@stdlib/stats/iter/cumin]</span><span class="delimiter">: </span><span class="description">create an iterator which iteratively computes a cumulative minimum value.</span>
|
|
154
|
+
- <span class="package-name">[`@stdlib/stats/iter/range`][@stdlib/stats/iter/range]</span><span class="delimiter">: </span><span class="description">compute the range of all iterated values.</span>
|
|
155
|
+
|
|
156
|
+
</section>
|
|
157
|
+
|
|
158
|
+
<!-- /.related -->
|
|
159
|
+
|
|
143
160
|
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
144
161
|
|
|
145
162
|
|
|
@@ -166,7 +183,7 @@ See [LICENSE][stdlib-license].
|
|
|
166
183
|
|
|
167
184
|
## Copyright
|
|
168
185
|
|
|
169
|
-
Copyright © 2016-
|
|
186
|
+
Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
170
187
|
|
|
171
188
|
</section>
|
|
172
189
|
|
|
@@ -185,9 +202,20 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
185
202
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/stats-iter-curange/main.svg
|
|
186
203
|
[coverage-url]: https://codecov.io/github/stdlib-js/stats-iter-curange?branch=main
|
|
187
204
|
|
|
205
|
+
<!--
|
|
206
|
+
|
|
188
207
|
[dependencies-image]: https://img.shields.io/david/stdlib-js/stats-iter-curange.svg
|
|
189
208
|
[dependencies-url]: https://david-dm.org/stdlib-js/stats-iter-curange/main
|
|
190
209
|
|
|
210
|
+
-->
|
|
211
|
+
|
|
212
|
+
[umd]: https://github.com/umdjs/umd
|
|
213
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
214
|
+
|
|
215
|
+
[deno-url]: https://github.com/stdlib-js/stats-iter-curange/tree/deno
|
|
216
|
+
[umd-url]: https://github.com/stdlib-js/stats-iter-curange/tree/umd
|
|
217
|
+
[esm-url]: https://github.com/stdlib-js/stats-iter-curange/tree/esm
|
|
218
|
+
|
|
191
219
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
192
220
|
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
193
221
|
|
|
@@ -201,6 +229,18 @@ Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors].
|
|
|
201
229
|
|
|
202
230
|
[mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
|
|
203
231
|
|
|
232
|
+
<!-- <related-links> -->
|
|
233
|
+
|
|
234
|
+
[@stdlib/stats/iter/cumax]: https://www.npmjs.com/package/@stdlib/stats-iter-cumax
|
|
235
|
+
|
|
236
|
+
[@stdlib/stats/iter/cumean]: https://www.npmjs.com/package/@stdlib/stats-iter-cumean
|
|
237
|
+
|
|
238
|
+
[@stdlib/stats/iter/cumin]: https://www.npmjs.com/package/@stdlib/stats-iter-cumin
|
|
239
|
+
|
|
240
|
+
[@stdlib/stats/iter/range]: https://www.npmjs.com/package/@stdlib/stats-iter-range
|
|
241
|
+
|
|
242
|
+
<!-- </related-links> -->
|
|
243
|
+
|
|
204
244
|
</section>
|
|
205
245
|
|
|
206
246
|
<!-- /.links -->
|
package/lib/main.js
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
|
|
24
24
|
var isIteratorLike = require( '@stdlib/assert-is-iterator-like' );
|
|
25
25
|
var isFunction = require( '@stdlib/assert-is-function' );
|
|
26
|
-
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
|
|
27
26
|
var iteratorSymbol = require( '@stdlib/symbol-iterator' );
|
|
28
27
|
var incrrange = require( '@stdlib/stats-incr-range' );
|
|
29
28
|
|
|
@@ -84,27 +83,26 @@ function itercurange( iterator ) {
|
|
|
84
83
|
* @returns {Object} iterator protocol-compliant object
|
|
85
84
|
*/
|
|
86
85
|
function next() {
|
|
87
|
-
var out;
|
|
88
86
|
var v;
|
|
89
87
|
if ( FLG ) {
|
|
90
88
|
return {
|
|
91
89
|
'done': true
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
|
-
out = {};
|
|
95
92
|
v = iterator.next();
|
|
96
|
-
if ( typeof v.value === 'number' ) {
|
|
97
|
-
out.value = acc( v.value );
|
|
98
|
-
} else if ( hasOwnProp( v, 'value' ) ) {
|
|
99
|
-
out.value = acc( NaN );
|
|
100
|
-
}
|
|
101
93
|
if ( v.done ) {
|
|
102
94
|
FLG = true;
|
|
103
|
-
|
|
95
|
+
return v;
|
|
96
|
+
}
|
|
97
|
+
if ( typeof v.value === 'number' ) {
|
|
98
|
+
v = acc( v.value );
|
|
104
99
|
} else {
|
|
105
|
-
|
|
100
|
+
v = acc( NaN );
|
|
106
101
|
}
|
|
107
|
-
return
|
|
102
|
+
return {
|
|
103
|
+
'value': v,
|
|
104
|
+
'done': false
|
|
105
|
+
};
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/stats-iter-curange",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Create an iterator which iteratively computes a cumulative range.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/assert-has-own-property": "^0.0.x",
|
|
41
40
|
"@stdlib/assert-is-function": "^0.0.x",
|
|
42
41
|
"@stdlib/assert-is-iterator-like": "^0.0.x",
|
|
43
42
|
"@stdlib/stats-incr-range": "^0.0.x",
|