stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

[RFC]: add `@stdlib/iter/cunone`

Open kgryte opened this issue 1 year ago • 0 comments

Description

This RFC proposes adding the package @stdlib/iter/cunone, which cumulatively tests whether every iterated value is falsy. The function should be a transform iterator, continuing to iterate while source iterator values are available.

var array2iterator = require( '@stdlib/array/to-iterator' );

var arr = array2iterator( [ false, false, false, true, false ] );

var it = iterCuNone( arr );

var v = it.next().value;
// returns true

v = it.next().value;
// returns true

v = it.next().value;
// returns true

v = it.next().value;
// returns false

v = it.next().value;
// returns false

var bool = it.next().done;
// returns true

Related Issues

No.

Questions

No.

Other

  • See also @stdlib/iter/none

Checklist

  • [X] I have read and understood the Code of Conduct.
  • [X] Searched for existing issues and pull requests.
  • [X] The issue name begins with RFC:.

kgryte avatar Jun 08 '24 00:06 kgryte