// i.e. first toggle starts collection, second one stops, third starts again, and so on.
When you know only the split value of each block, you can use the default split mode,
with carryEnd set to 1/forward (in case you do not want it skipped):
When you know both start and end values of each block, you can use the toggle mode,
with carryStart set to 1/forward, and carryEnd set to -1/back, unless you want
either of those skipped, then leave them at 0/none.
Note that in toggle mode, you cannot use carryStart=back (it will be ignored),
because it would delay emission of the current block indefinitely, plus carrying
block start backward doesn't make much sense anyway.
Note that the predicate can only return a Promise inside an asynchronous pipeline,
or else the Promise will be treated as a truthy value.
Splits values into separate lists when predicate returns
true
(or resolves withtrue
):When option
toggle
is set, the split uses the toggle start/end logic:When you know only the split value of each block, you can use the default split mode, with
carryEnd
set to1/forward
(in case you do not want it skipped):When you know only the end value of each block, you can use the default split mode, with
carryEnd
set to-1/back
(in case you do not want it skipped):When you know both start and end values of each block, you can use the
toggle
mode, withcarryStart
set to1/forward
, andcarryEnd
set to-1/back
, unless you want either of those skipped, then leave them at0/none
.Note that in
toggle
mode, you cannot usecarryStart=back
(it will be ignored), because it would delay emission of the current block indefinitely, plus carrying block start backward doesn't make much sense anyway.Note that the predicate can only return a
Promise
inside an asynchronous pipeline, or else thePromise
will be treated as a truthy value.